Schema-Based Tool Registration and Handling#92
Schema-Based Tool Registration and Handling#92KthKuang wants to merge 2 commits intomodelcontextprotocol:mainfrom
Conversation
|
Hi @KeithBird. Thanks for opening this PR. There's a thread about designing a high-level API in #27. I think one of the requirements for a high-level API is the ability to dynamically add and remove tools, which I think will require an entirely separate layer on top of what we have now with Regarding swift-json-schema, I also looked at this package, but found it to be too heavy of a dependency for this particular use case. For my own projects, I'm using this one instead. |
|
Happened to stumble on this today. I just released swift-mcp-toolkit that bridges Definitely understand the concern that |
Overview
Introduces the
@Schemablemacro for type-safe, schema-driven tool handling in MCP servers.Key Features
withToolsmethod that automatically configures MCP'slistToolsandcallToolmethods.SchemaToolinstances, allowing batch registration with the server.Example Usage
Motivation
Implementation
How Has This Been Tested?
Unit test in
SchemaMCP/Tests/Test.swift. Already tested in a real application.Breaking Changes
Types of changes
Checklist
Design Inspiration
This interface's design draws inspiration from best practices found in two major MCP libraries:
Additional context
I'm opening this PR directly for discussion purposes. Since the implementation is relatively small (primarily in
SchemaTool.swift), I believe it's more efficient to discuss the actual code.Note that this branch is intended for discussion only, as the
swift-json-schemadependency requires a higher minimum version than our current library supports.