discontinuedPackage fluttersdk_artisan has been discontinued and replaced by dowel.

registerMcpToolsFor method

void registerMcpToolsFor(
  1. ArtisanServiceProvider provider
)

Register all MCP tool descriptors contributed by provider.

Mirrors registerAll's collision discipline: every descriptor is inserted into _mcpTools keyed by McpToolDescriptor.name; a duplicate name throws ArtisanMcpToolCollisionException naming both the existing and the conflicting provider. There is no override escape hatch (V1): MCP tool names map 1:1 to the JSON-RPC method surface exposed to the LLM client, and silent shadowing would make behaviour undebuggable.

NOT called from registerProvider. The MCP entry path (runArtisan(args, collectMcpTools: true)) opts in explicitly so that CLI invocations skip the descriptor walk + validation cost.

Implementation

void registerMcpToolsFor(ArtisanServiceProvider provider) {
  for (final tool in provider.mcpTools()) {
    final existing = _mcpTools[tool.name];
    if (existing != null) {
      throw ArtisanMcpToolCollisionException(
        toolName: tool.name,
        existingProvider: existing.providerName,
        newProvider: provider.providerName,
      );
    }
    _mcpTools[tool.name] = _RegisteredMcpTool(tool, provider.providerName);
  }
}