Description
Currently, Annotations *tools.ToolAnnotations is individually defined on every tool's Config struct across all packages (e.g., in internal/tools/<source>/<tool>/<tool>.go).
Since ToolAnnotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint) are standard MCP metadata applicable to all tools, this field should be centralized in tools.ConfigBase alongside Name, Description, AuthRequired, and ScopesRequired.
Because every tool's Config struct already embeds tools.ConfigBase with yaml:",inline", moving Annotations to ConfigBase will remove significant boilerplate across 100+ files without changing any YAML configuration schemas or runtime behavior.
Proposed Changes
-
Update tools.ConfigBase:
- Add
Annotations *ToolAnnotations with yaml:"annotations,omitempty" to tools.ConfigBase in internal/tools/tools.go.
- (Optional) Add a
GetAnnotations() *ToolAnnotations getter on ConfigBase if needed for ToolMeta.
-
Clean up individual tool Config structs:
- Remove redundant
Annotations *tools.ToolAnnotations field definitions from all tool Config structs in internal/tools/....
- Tool
Initialize() methods can continue accessing cfg.Annotations directly via embedded struct promotion.
-
Update tests & mocks:
-
Update Developer Documentation:
- Update
DEVELOPER.md and GEMINI.md to document annotations as one of the shared fields supplied by tools.ConfigBase.
Expected Impact
- Breaking Changes: None. YAML unmarshaling remains backward-compatible via
yaml:",inline".
- Scope: Mechanical refactor touching tool
Config structs across internal/tools/.
Description
Currently,
Annotations *tools.ToolAnnotationsis individually defined on every tool'sConfigstruct across all packages (e.g., ininternal/tools/<source>/<tool>/<tool>.go).Since
ToolAnnotations(readOnlyHint,destructiveHint,idempotentHint,openWorldHint) are standard MCP metadata applicable to all tools, this field should be centralized intools.ConfigBasealongsideName,Description,AuthRequired, andScopesRequired.Because every tool's
Configstruct already embedstools.ConfigBasewithyaml:",inline", movingAnnotationstoConfigBasewill remove significant boilerplate across 100+ files without changing any YAML configuration schemas or runtime behavior.Proposed Changes
Update
tools.ConfigBase:Annotations *ToolAnnotationswithyaml:"annotations,omitempty"totools.ConfigBaseininternal/tools/tools.go.GetAnnotations() *ToolAnnotationsgetter onConfigBaseif needed forToolMeta.Clean up individual tool
Configstructs:Annotations *tools.ToolAnnotationsfield definitions from all toolConfigstructs ininternal/tools/....Initialize()methods can continue accessingcfg.Annotationsdirectly via embedded struct promotion.Update tests & mocks:
MockToolConfigininternal/testutils/mocks.goand any unit/integration tests constructing tool configs.Update Developer Documentation:
DEVELOPER.mdandGEMINI.mdto documentannotationsas one of the shared fields supplied bytools.ConfigBase.Expected Impact
yaml:",inline".Configstructs acrossinternal/tools/.