Skip to content

refactor(tools): move Annotations field into tools.ConfigBase #3809

Description

@anubhav756

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

  1. 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.
  2. 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.
  3. Update tests & mocks:

  4. 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/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: cleanupAn internal cleanup or hygiene concern.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions