Add Tools Annotation #28
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 standardized annotations property to all tool classes in the codebase, providing structured metadata about each tool's behavior (such as whether it is read-only, destructive, idempotent, etc.). Additionally, the
BaseTooland related registration logic are updated to require and propagate these annotations. There are also minor updates to the development workflow inpackage.json.Tool metadata standardization:
Added a required
annotationsproperty (of typeToolAnnotations) to theBaseToolclass and all tool implementations, describing each tool's characteristics (e.g., read-only, destructive, idempotent, open-world, and a human-friendly title). (src/tools/BaseTool.ts,src/tools/bounding-box-tool/BoundingBoxTool.ts,src/tools/bounding-box-tool/CountryBoundingBoxTool.ts,src/tools/coordinate-conversion-tool/CoordinateConversionTool.ts,src/tools/create-style-tool/CreateStyleTool.ts,src/tools/create-token-tool/CreateTokenTool.ts,src/tools/delete-style-tool/DeleteStyleTool.ts,src/tools/geojson-preview-tool/GeojsonPreviewTool.ts,src/tools/get-mapbox-doc-source-tool/GetMapboxDocSourceTool.ts,src/tools/list-styles-tool/ListStylesTool.ts,src/tools/list-tokens-tool/ListTokensTool.ts,src/tools/preview-style-tool/PreviewStyleTool.ts,src/tools/retrieve-style-tool/RetrieveStyleTool.ts,src/tools/style-builder-tool/StyleBuilderTool.ts,src/tools/style-comparison-tool/StyleComparisonTool.ts,src/tools/tilequery-tool/TilequeryTool.ts,src/tools/update-style-tool/UpdateStyleTool.ts) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17]Updated the
BaseTool.installTomethod to useserver.registerTooland pass the new annotations property as part of tool registration, ensuring this metadata is available at runtime.Development workflow improvements:
dev:inspectscript topackage.jsonfor easier debugging with the inspector, and bumped the package version to0.4.1. [1] [2]Dependency and import updates:
ToolAnnotationstype from the SDK inBaseTool.tsto support the new annotations property.