Add MCP-based custom tool architecture
Introduces in-process MCP servers for custom tool definitions, matching the
Python Claude Agent SDK's approach. Built-in tools (Read, Write, Bash, etc.)
are handled by Claude CLI, while custom tools are executed via MCP servers.
New modules:
- Tool: Custom tool definitions with schema helpers
- schema_string, schema_int, schema_object, schema_array, etc.
- text_result, error_result for formatting responses
- create for defining tools with typed handlers
- Mcp_server: In-process MCP server implementation
- JSONRPC protocol for initialize, tools/list, tools/call
- Automatic tool dispatch based on registered handlers
Integration:
- Options.with_mcp_server to register MCP servers
- Client routes Mcp_message control requests to registered servers
- Tools accessible as mcp__<server_name>__<tool_name>
Testing:
- Consolidated test suite with 30 alcotest cases
- Coverage for Protocol, Tool, Mcp_server, Tool_input, structured errors
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>