Add Tools Annotation #50
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new annotation system for all tools in the MCP server, standardizes tool structure via a new
BaseToolabstract class, and ensures that all tools expose consistent metadata. It also adds comprehensive tests to verify the presence and correctness of these annotations. These changes improve the extensibility, maintainability, and introspection of the tool system.Tool architecture and annotation improvements:
BaseToolinsrc/tools/BaseTool.tsthat standardizes tool structure and enforces the presence ofannotationsand related metadata on all tools. This includes a unifiedinstallTomethod and logging helper.MapboxApiBasedTooland all tool classes (e.g.,CategoryListTool,CategorySearchTool,DirectionsTool,IsochroneTool,MatrixTool,ReverseGeocodeTool,SearchAndGeocodeTool,StaticMapImageTool,VersionTool) to extend fromBaseTool, and added a requiredannotationsproperty to each, specifyingtitle,readOnlyHint,destructiveHint,idempotentHint, andopenWorldHint. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]Testing and validation:
test/tools/annotations.test.tsto ensure all tools have the required annotations, can be installed to the server, and that annotation values (such asreadOnlyHintandopenWorldHint) are correct for each tool type.Build and package updates:
dev:inspecttopackage.jsonfor easier development and inspection of the MCP server.0.5.1to0.5.2to reflect these changes.Other minor changes:
BaseTool. [1] [2]src/index.tsto remove unused capabilities.