Skip to content

Support meta and annotation in mcp tools #14084

Description

@luoxiner

Is your feature request related to a problem? Please describe.

The current MCP Tool model in Nacos does not fully comply with the MCP protocol specification. According to the MCP protocol, Tool objects should support two additional fields:

  • _meta: A generic metadata object for storing arbitrary key-value pairs
  • annotations: Additional properties describing a Tool to clients (ToolAnnotations)

Without these fields, Nacos cannot store and manage the complete MCP Tool specification, which limits interoperability with MCP-compliant clients and servers.

Describe the solution you'd like

Add support for _meta and annotations fields in the MCP Tool model:

  1. Backend Changes:

    • Add _meta field to McpTool.java with proper JSON serialization using @JsonProperty("_meta")
    • Create McpToolAnnotations.java class with the following fields as defined in MCP protocol:
      • title (String): A human-readable title for the tool
      • readOnlyHint (Boolean): If true, the tool does not modify its environment
      • destructiveHint (Boolean): If true, the tool may perform destructive updates
      • idempotentHint (Boolean): If true, repeated calls have no additional effect
      • openWorldHint (Boolean): If true, the tool may interact with external entities
    • Add annotations field to McpTool.java
  2. Frontend Changes:

    • Add "Meta" tab in CreateTools dialog with JSON editor for _meta field
    • Add "Annotations" tab in CreateTools dialog with form controls for annotation fields
    • Display _meta and annotations in ShowTools component

Describe alternatives you've considered

  1. Store as generic Map<String, Object>: We could store both fields as generic maps, but this would lose type safety for annotations and make frontend form binding more complex.

  2. Only support _meta field: We could implement only the _meta field as it's more flexible, but this would still leave Nacos non-compliant with the full MCP Tool specification.

Additional context

MCP Protocol Tool Definition Reference:

{
  "name": "tool_name",
  "description": "Tool description",
  "inputSchema": {...},
  "_meta": {
    "additionalProperties": {},
    "type": "object"
  },
  "annotations": {
    "title": "Human readable title",
    "readOnlyHint": false,
    "destructiveHint": true,
    "idempotentHint": false,
    "openWorldHint": true
  }
}

Note: All properties in annotations are hints and are not guaranteed to provide a faithful description of tool behavior. Clients should never make tool use decisions based on annotations received from untrusted servers.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions