model library
A model editor offered to an agent, over the Model Context Protocol.
The same commands a person uses, offered as tools. Every command tool
here is a ModelCommand from flutter3d_model_core — the values the
modeller application's own toolbar and keyboard go through — so an edit
made by an agent and an edit made by a hand take one route into the
project, get one name in the history, and come back out under the same
undo.
Beyond the commands, ModelSession adds the verbs a screen would
otherwise supply: ModelSession.listing and ModelSession.select,
because a program with no screen cannot point at anything; check, save,
export and import, because a project has a life outside the commands
that shape it; journal, because doc-16's CommandJournal is worth
writing to disk from the one place that already runs every command; and
mcp-09n's own composite recipes — cleanup, buildFrom and
inspect — because an agent assembling one out of the commands above
by hand is slow, expensive, and leaves a whole batch of edits as many
undo steps instead of one.
What it is not
Not a connection to a running editor. The server owns one project for
the life of one process, started by dart run. This is the half that can
be tested without a device: deterministic text out, and a suite that
drives the real protocol over a pair of streams in memory.
It does draw, though nothing else here answers with a picture.
render (mcp-06n) and renderSheet (mcp-07n, a 2×2 contact sheet of
four views) are the two tools built on flutter3d_cpu's own CpuDevice
— no GPU, no display, and, since flutter3d_conformance and
flutter3d_shaders stopped carrying the Flutter SDK in behind it, no cost
to dart run's own ability to start this server with no Flutter tool on
the machine at all. See render_tool.dart's own doc comment for why
every other tool still answers with no png rather than every tool body
here having grown one.
dart run flutter3d_mcp:model_mcp my-model.f3dproj
Classes
- Answer
- What a tool call actually did, and the sentence to say about it.
-
AnsweredCall<
A> - One call a ToolTableServer answered, as a watcher is told of it: ToolTableServer.onCall with the server's own answer type, ToolTableServer.onProjectCall with a project tool's ToolResult.
- CommandTarget
-
What a call says it acts on, instead of leaving it to the selection —
ux-20. See ModelSession.targetIn for how it is read out of a call's own arguments, and ModelSession.runOn for what it does. - ModelHttpServer
-
A ModelMcpServer listening on
127.0.0.1, for ModelHttpServer.start. - ModelMcpServer
- A model project, offered to an agent as a table of tools.
- ModelSession
- One model project, open, with the editor's own verbs on it.
-
SessionToolCall<
S> - One call of a server's own tool: a ToolCall with the session the server runs it against.
- ToolAudio
-
A sound a tool answers with: the encoded bytes and their media type
(
audio/wav,audio/ogg). - ToolCall
- One call of a project tool: what an agent passed, under the name it called.
- ToolContent
- One piece of what a tool answers: words, a picture, a sound, a resource or a link to one, as the protocol's content objects say them.
- ToolHints
- What a tool does to the world it is called on, as the protocol's annotations say it to a host — which may ask a person before a destructive call, and may call a read-only one without asking.
- ToolImage
- A picture a tool answers with: the encoded bytes and their media type.
- ToolOtherContent
- Content of a kind this build has no class for, kept as the JSON it came as and written back unchanged.
- ToolResource
- A resource carried inside the answer: its uri, and its contents as text or as bytes (blob).
- ToolResourceLink
- A link to a resource the client may read, rather than its contents.
- ToolResult
-
What a tool call answers: content for a model to read, and the
machine-readable structuredContent when the tool declares an
outputSchema. - ToolSpec
-
One tool, as
tools/listoffers it: a name, a sentence, the JSON Schema of its arguments, the JSON Schema of thestructuredContentit answers with when it answers one, and its ToolHints. - ToolText
- Words a tool answers with.
Constants
-
describableFamilies
→ const List<
String> -
The families
describeTypecan be asked about. -
modelAnswerSchema
→ const Map<
String, Object?> -
The shape of every model tool's
structuredContent— whatModelSession.structuredwrites — as theoutputSchemaeach tool declares. - modelMcpSchemaVersion → const String
-
The version of this server's tools — names and input schemas — as the
initializeresult announces it beside modelMcpVersion. - modelMcpUsage → const String
-
What
model_mcpprints for--helpand for a wrong argument count. - modelMcpVersion → const String
- The version this server tells a client it is: the pubspec's.
-
modelPrompts
→ const List<
OfferedPrompt> - The advice, offered to every client that asks for it.
-
modelToolNames
→ const Map<
String, ToolName> -
What each of the modeller's tools is published as,
area.verb, and what it does to the project. The written name — the model command's own word, whichhistory.batchand the command journal still use — stays an alias until 2.0. -
renderModes
→ const List<
String> -
Every mode an agent can ask for —
mcp-08n's own four, plusselection, which the row does not count because it is not a shading mode.wireframelanded 2026-09-17 as geometry rather than as a line topology;RenderShading.wireframeandwire_overlay.dartboth say why.
Properties
- auditTool → ModelPictureTool
-
audit:AssetAuditin words and the asset from all seven views in one picture, withrepairto put right what has one right answer.final -
modelTools
→ List<
ModelTool> -
Everything this server offers: every command as a tool, and the verbs
that are about the session rather than about one edit —
listandselect, because a program with no screen cannot point at anything;undo/redo;check,save,exportandimport, because a project has a life outside the commands that shape it;journal, becauseCommandJournalis worth writing from the one place that runs every command already.no setter - renderSheetTool → ModelPictureTool
-
A contact sheet of
renderSheetViews—mcp-07n's own tool. Labelled: each quadrant carries the name of the view it is, drawn withtiny_font.dartrather than a widget, since this runs in a plain Dart process with no canvas in it.final - renderSnapshotTool → ModelPictureTool
-
pro-rn-04: a snapshot at a size and a supersample a person chooses, throughpro-rn-02's own tiled job.final - renderTool → ModelPictureTool
-
A picture of the project as it stands.
final
Functions
-
deleteMcpSessionFile(
File file) → void - Removes the session file writeMcpSessionFile wrote — called once the server it named is no longer listening, so nothing reads a port that has gone stale.
-
describeType(
{required String family, String? kind}) → String -
What
kindtakes, or — with nokind— every kind offamilyat once. -
serveModelMcp(
List< String> arguments, {McpTools? projectTools}) → ModelMcpServer? -
Opens the project
argumentsnames and serves it over stdio, offeringprojectToolsbeside the modeller's own. -
writeMcpSessionFile(
File file, {required int port, required String token}) → void - Where an application's own running LoopbackMcpServer can be found, written beside the application's existing session state.
Typedefs
-
ModelPictureTool
= OfferedTool<
ModelSession, Answer> - A modeller tool that may answer with a picture: a body over the ModelSession that answers an Answer.
-
ModelTool
= OfferedTool<
ModelSession, Answer> -
One tool: what an agent is offered, and what calling it does — see
flutter3d_mcp/kit.dart's OfferedTool for why a pair rather than a table and a switch.