project_tools library

McpTools alone: the registry a project's plugins fill with their MCP tools, without the servers and the loopback transport.

For an application that keeps the registry and runs no server in the same build. kit.dart exports the loopback HTTP server too, which reaches dart:io, and an application built for the browser — the level editor is one — cannot import it. This library imports nothing that a browser lacks, so the editor installs its plugins into the same McpTools on every platform and a server started beside it on the desktop is handed that registry as projectTools.

Classes

McpToolRegistry
MCP tools, merged into the project's servers as <namespace>.<tool>: the slot McpTools fills, host.registry<McpTools>().
McpTools
The McpToolRegistry a project fills: the MCP tools its plugins bring, each under the plugin's namespace.
ProjectTool
One tool a plugin, or the application, added to a project's McpTools.
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).
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/list offers it: a name, a sentence, the JSON Schema of its arguments, the JSON Schema of the structuredContent it answers with when it answers one, and its ToolHints.
ToolText
Words a tool answers with.

Typedefs

ProjectToolRun = FutureOr<ToolResult> Function(ToolCall call)
What calling a project tool does: one ToolCall in, a result out.