/flutter-mcp-toolkit:flutter-mcp-toolkit-custom-toolsfrom flutter-mcp-toolkit
Registers custom MCP tools and resources inside a Flutter app using mcp_toolkit's dynamic registry. Covers AgentCallEntry, addEntries, tool vs resource vs evaluate-expression, schema strictness, and lifecycle pitfalls.
Ships in flutter-mcp-toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use this when bundled MCP tools (screenshot, semantic snapshot, tap, …) are not enough and you need app-specific read surfaces or actions — e.g. cart totals, feature flags, curated debug snapshots of internal state. Entries are registered in the Flutter process and exposed to the agent through the dynamic registry.
Migration: The legacy call-entry type was removed in intentcall Phase 6b. Use
AgentCallEntryormcpToolkitTool/mcpToolkitResource. Seeflutter-mcp-toolkit-intentcall-migration.
Boundary: Change app discovery, Flutter VM-service extensions, or app-owned debug surfaces here. Change canonical registry/session semantics, schema policy, platform projection, or publish behavior in the upstream IntentCall repository.
| Need | Use |
|---|---|
| One-off read of a simple value | fmt_evaluate_dart_expression (no app code change). |
| Stable read-only payload (diagnostics, JSON snapshot, “current route”) | AgentCallEntry.resource + fmt_client_resource. Prefer resources when the contract is “GET-like” and idempotent. |
| Parameterized or mutating action, or reusable named operation | AgentCallEntry.tool + fmt_client_tool. |
AgentCallEntry (preferred for new code)Handlers receive AgentArguments (Map<String, Object?>) and return AgentResult:
import 'package:mcp_toolkit/mcp_toolkit.dart';
final tool = AgentCallEntry.tool(
namespace: 'app',
name: 'cart_get_snapshot',
description: 'Return current cart total and items for a user.',
inputSchema: const {
'type': 'object',
'additionalProperties': false,
'properties': {
'userId': {'type': 'string'},
},
'required': ['userId'],
},
handler: (final args) async {
final userId = args['userId']?.toString() ?? '';
final cart = CartRepository.instance.forUser(userId);
return AgentResult.success(
message: 'ok',
data: {
'total': cart.total,
'items': cart.items.map((final i) => i.toJson()).toList(),
},
);
},
);
await MCPToolkitBinding.instance.addEntries(entries: {tool});
MCPToolDefinition + MCPCallResult (bridge)Built-in toolkits still use mcpToolkitTool / mcpToolkitResource to adapt
Map<String, String> service-extension handlers:
final tool = mcpToolkitTool(
namespace: 'app',
handler: (final request) async {
final userId = request['userId'] ?? '';
return MCPCallResult(
message: 'ok',
parameters: {'userId': userId},
);
},
definition: MCPToolDefinition(
name: 'cart_get_snapshot',
description: 'Return current cart total and items for a user.',
inputSchema: ObjectSchema(
properties: {
'userId': StringSchema(),
},
required: ['userId'],
),
),
);
int.tryParse, jsonDecode, etc.request.arguments on the app side.Prefer MCPToolkitBinding.instance.addEntries(entries: { ... }) before bootstrapFlutter(runApp: ...) so tools/resources register in one place with zone/error setup.
Register once at bootstrap — not inside build, not per-widget initState.
final resource = AgentCallEntry.resource(
namespace: 'app',
name: 'app_cart_digest',
description: 'Compact cart summary for agents (read-only).',
mimeType: 'application/json',
handler: (final args) async => AgentResult.success(
message: 'Cart digest',
data: {
'itemCount': CartRepository.instance.visibleCount,
'currency': CartRepository.instance.currencyCode,
},
),
);
Or via bridge:
mcpToolkitResource(
namespace: 'app',
definition: MCPResourceDefinition(
name: 'app_cart_digest',
description: 'Compact cart summary for agents (read-only).',
mimeType: 'application/json',
),
handler: (final request) async => MCPCallResult(
message: 'Cart digest',
parameters: {'itemCount': 3},
),
),
name must be snake_case. Published resource URIs follow visual://localhost/... conventions; agents use fmt_client_resource and listings from fmt_list_client_tools_and_resources.The MCP server enforces strict JSON Schema:
additionalProperties: false unless you intentionally accept arbitrary keys.required for anything the handler reads unconditionally.AgentResult.data / MCPCallResult.parameters must be JSON-serializable.fmt_list_client_tools_and_resources — enumerate app-registered tools and resources.fmt_client_tool — invoke a dynamic tool by name with JSON args.fmt_client_resource — fetch a registered resource URI from the listing.If something should appear but does not: confirm addEntries completed (await), then hot restart.
addEntries from widget code → duplicate registrations. Register once in main() / bootstrap.cart_, flags_, nav_). If a built-in entry already uses a name, the custom entry is skipped without warning; the built-in handles the call and the custom handler does not run.MCPToolkitBinding.instance.setAppIdentity(label: 'Fleet app · staging'), called again whenever the name changes (sign-in, workspace switch). Discovery reads that label, and a tool of your own called app_identity is one of the collisions above.mcp_toolkit is in pubspec.yaml.lib/mcp_tools/<domain>_surfaces.dart returning Set<AgentCallEntry> or calling addEntries once.addEntries(...) before bootstrapFlutter(...) — never from StatefulWidget lifecycle.fmt_list_client_tools_and_resources before first client invoke.AgentArguments with Map<String, String> — pick one API (native vs mcpToolkitTool).await on addEntries → race before discovery.inputSchema out of sync with the handler → agents trust the schema; update both.flutter-mcp-toolkit-intentcall-migration — CLI migrator, breaking upgradeflutter-mcp-toolkit-guide → inspect / control / debug skillsWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
mcp-toolkit, flutter-mcp, dynamic-registry, agent-call-entry
npx claudepluginhub arenukvern/mcp_flutter --plugin flutter-mcp-toolkit16 skills in this plugin
/flutter-mcpUse this skill whenever inspecting, interacting with, or live-editing a running Flutter app via the Flutter MCP toolkit server (`mcpServers` key **`flutter-mcp-toolkit`**). Covers preflight, snapshot/tap/enter/scroll loop, hot-reload validation, and error envelope parsing./flutter-mcp-automation-chainUse this skill when wiring automation for a Flutter app — choosing the right surface (interactive MCP `fmt_*` tools, CLI one-shots, programmatic `flutter_mcp_harness` Dart scenarios, the browser CDP tier, or an external build+lifecycle runner like oka), composing the chain end-to-end, or integrating `oka` (`oka init`/`dev`/`run`, device targets, the runner-session contract, `driverForLiveSession`). Also use when the user asks which tier or mode to use, how to drive/build their app from Dart or CI without a chat round-trip, or how oka and flutter-mcp-toolkit fit together. For authoring repeatable scenarios inside this repo's showcase, use `flutter-mcp-e2e-harness`; for interactive debugging, use `flutter-mcp`./flutter-mcp-boundary-auditGeneric contract/schema boundary audit across authoring, discovery, validation, and execute—detecting split-brain between listings and invoke paths, gateway divergence, and permissive placeholders. Use when changing tool registration, RPC/plugin registries, dynamic tools, MCP or WebMCP surfaces, CLI exec aliases, OpenAPI or JSON Schema contracts, migrators/codegen, bridge argument encoding, or platform docs that describe API contracts./flutter-mcp-cli-runtime-validationRun Flutter MCP runtime validation from CLI in two steps (launch app, then run validate-runtime), including toolkit-extension gating, screenshot/layout capture, app error collection, optional reload verification, and retry handling for transient first-connect failures./flutter-mcp-e2e-harnessUse this skill when writing or running repeatable E2E scenarios for Flutter apps as checked-in Dart with the `flutter_mcp_harness` package (`packages/harness`) — build/launch the app, attach to its VM service, drive widgets (snapshot/tap/enter text) and assert without MCP; also covers the repo showcase launcher (`make showcase`, `--web`, `--stop`) and multi-instance desktop compositions. For interactive assistant-driven debugging through MCP `fmt_*` tools, use `flutter-mcp` instead./flutter-mcp-toolkit-controlDrive a running Flutter app — tap, scroll, type, fill forms, hot-reload, navigate. Use when you need to interact with the UI.Other plugins' skills for the same job