Fix MCP docs introspection snippet

This commit is contained in:
Nick Sweeting 2026-07-25 22:20:25 -07:00
parent b7eab3ebda
commit c8d0e2e8e7
No known key found for this signature in database
2 changed files with 8 additions and 15 deletions

View File

@ -94,21 +94,14 @@ The server exposes all ArchiveBox CLI commands:
Instead of manually defining schemas, the server uses Click's introspection API to automatically generate MCP tool definitions:
```python
import click
from archivebox.cli import ArchiveBoxGroup
from archivebox.mcp.server import click_command_to_mcp_tool
cli_group = ArchiveBoxGroup()
context = click.Context(cli_group)
from archivebox.mcp.server import MCPServer, click_command_to_mcp_tool
tools = []
for command_name in cli_group.all_subcommands:
command = cli_group.get_command(context, command_name)
assert command is not None
tools.append(click_command_to_mcp_tool(command_name, command))
for discovered_tool in MCPServer().get_tools().values():
tools.append(click_command_to_mcp_tool(discovered_tool))
assert {tool["name"] for tool in tools} == set(cli_group.all_subcommands)
assert {tool["name"] for tool in tools}
assert all("inputSchema" in tool for tool in tools)
```
### Tool Execution

View File

@ -62,7 +62,7 @@ version = 2
"49747d67b7e3ea8d-1" = "illustration"
"fead0184493aab00-1" = "illustration"
"256531ee2b730012-1" = "illustration"
"399c370c70523428-1" = "run"
"0b307d4f1033723f-1" = "run"
"7d33d72cc96df65b-1" = "run"
# skills/archivebox/SKILL.md
@ -272,7 +272,7 @@ version = 2
"396490664ce459e9-1" = "project"
"d9ff84abeb97d380-1" = "collection"
"aebc15190116f5cd-1" = "collection"
"399c370c70523428-1" = "collection"
"0b307d4f1033723f-1" = "collection"
"7d33d72cc96df65b-1" = "collection"
"2695777473e3a217-2" = "project"
"b894a7c4f93e4e92-2" = "system"
@ -353,7 +353,7 @@ version = 2
"396490664ce459e9-1" = "ubuntu"
"d9ff84abeb97d380-1" = "ubuntu"
"aebc15190116f5cd-1" = "ubuntu"
"399c370c70523428-1" = "ubuntu"
"0b307d4f1033723f-1" = "ubuntu"
"7d33d72cc96df65b-1" = "ubuntu"
"2695777473e3a217-2" = "ubuntu"
"b894a7c4f93e4e92-2" = "ubuntu"