Skip to main content

Example: MCP Toolsets

Hands-on walkthrough for registering sample toolsets and invoking them from an AI client. For authoring guides, see MCP .NET and MCP Python.

Samples​

SampleLinkBackend
Python toolsetsamples/PythonDemo/mcp_toolsetPython folder + *mcp.py entry file
.NET demosamples/McpToolsetDemoC# assembly (minimal)
Revit toolsetsamples/RevitMcpToolSetC# assembly (full Revit surface)

RevitMcpToolSet and PythonDemo/mcp_toolset implement the same tool surface per TOOLSET-SPEC.md. Load one implementation per host instance — do not register Python and C# toolsets with overlapping tool names at the same time.

What Each Sample Shows​

SamplePurpose
McpToolsetDemo.NET tools, prompts, and resources — parser and schema edge cases
RevitMcpToolSetProduction-style Revit MCP tools, resource templates, prompts
PythonDemo/mcp_toolsetPython layout, DTOs, services, parser test files

Register in Settings​

Toolsets are not auto-discovered from script folders. Register each toolset explicitly:

  1. Open the RevitDevTool panel → Settings → MCP
  2. Add a toolset entry:
    • .NET: path to the built assembly (e.g. RevitMcpToolSet.dll after dotnet build)
    • Python: folder path containing a *mcp.py entry file
  3. Save settings and wait for the host catalog to reload
  4. Open the MCP registry view in the host UI — confirm tools, resources, and prompts appear
  5. From your AI client, search_dynamic for a tool name (e.g. revit_find_elements or get_demo_status) and invoke_dynamic with the returned capabilityId

The MCP server tools/list still shows only infrastructure tools. Custom toolset tools appear only through search_dynamic.

Build the .NET Samples​

dotnet build samples/McpToolsetDemo/McpToolsetDemo.csproj
dotnet build samples/RevitMcpToolSet/RevitMcpToolSet.csproj

Point Settings → MCP at the built DLL under bin/. See MCP C# SDK for project setup and attribute patterns.

Python Folder​

Register the folder that contains a *mcp.py entry file. Dependencies belong in that entry file's PEP 723 header; conftest.py is not used for MCP registration. See MCP Python SDK for the sample layout and @mcp.tool conventions. Wire names use snake_case only (no Field(alias=) on parameters).

Run / Try​

  1. Build the .NET sample (if testing assembly-based discovery)
  2. Register the assembly path or Python folder in Settings → MCP
  3. Confirm entries in the host MCP registry UI
  4. Confirm your AI client MCP config uses --stdio (see MCP .NET or MCP Python)
  5. In the AI client: search_dynamic(query="<tool_name>") → invoke_dynamic(capabilityId=...)
  6. Call a read-only tool first (e.g. get_demo_status, revit_get_model_summary), then mutating tools

Troubleshooting​

SymptomCheck
Toolset not in registry UIPath registered in Settings → MCP; .NET DLL built for correct host/API version
Python toolset not visibleFolder contains a *mcp.py file; its PEP 723 dependencies resolve successfully; the entry module imports without errors
search_dynamic finds nothingHost running with add-in loaded; MCP pipe exists (DevToolsMcp_*); toolset registered and catalog reloaded
invoke_dynamic stale IDHost disconnected or catalog changed — search_dynamic again, then invoke new capabilityId
Tool appears but call failsTest a read-only tool first; check host document/selection preconditions
AI client cannot connectMCP config points to DevTools.Daemon.exe with args: ["--stdio"]; .NET 10 installed
AI client connects but no hostsAt least one host open with RevitDevTool loaded; use list_host_instances