Skip to content

[Bug]: Tools Annotations not working and need specificity for mentioning annotations #774

@KaRtHiK-56

Description

@KaRtHiK-56

🐞 Bug Summary

Tool annotations added via the admin UI or API are not persisted(For API please give us the detailed documentation on how to annotation while registering server or via tool edit from UI). They do not appear in the UI or in the tool schema JSON returned by the API. The annotations field remains empty ({}) even after successful updates.

Image

In the above image via the Admin UI i tried adding annotation badge in the edit option as

"annotations": {
      "readOnlyHint": true,
      "destructiveHint": false,
      "idempotentHint": false,
      "openWorldHint": false
    } 
and 
"annotations": {
      "readOnlyHint": true
}

and 
{
      "readOnlyHint": true
}

but if i see in my terminal this is the response

INFO  [mcpgateway.services.tool_service] Updated tool: local-mcp-calculate-bmi
INFO:     127.0.0.1:60449 - "POST /admin/tools/4c5ad8d18d9b40a39239c487abdfc3aa/edit HTTP/1.1" 200 OK
INFO:     127.0.0.1:60449 - "GET /admin HTTP/1.1" 307 Temporary Redirect
INFO:     127.0.0.1:60449 - "GET /admin/ HTTP/1.1" 200 OK
INFO:     127.0.0.1:60449 - "GET /static/admin.js HTTP/1.1" 304 Not Modified
INFO:     127.0.0.1:60450 - "GET /static/admin.css HTTP/1.1" 304 Not Modified

But there is no reflection in UI console as mentioned in the above screenshots as well as in the /tools/ json response

{
    "id": "xxxxxxxxxxxxxxxxxxxxxxxxx",
    "originalName": "add",
    "url": "http://xxxx:8010/sse",
    "description": "Add two numbers",
    "requestType": "SSE",
    "integrationType": "MCP",
    "headers": null,
    "inputSchema": {
      "properties": {
        "a": {
          "title": "A",
          "type": "integer"
        },
        "b": {
          "title": "B",
          "type": "integer"
        }
      },
      "required": [
        "a",
        "b"
      ],
      "title": "addArguments",
      "type": "object"
    },
    **"annotations": {

    }**,
    "jsonpathFilter": "",
    "auth": null,
    "createdAt": "2025-08-18T06:54:24.968605",
    "updatedAt": "2025-08-18T06:54:24.968606",
    "enabled": true,
    "reachable": true,
    "gatewayId": "e0f6ecc3a4c74044b6809a081c1a15ab",
    "executionCount": 0,
    "metrics": {
      "totalExecutions": 0,
      "successfulExecutions": 0,
      "failedExecutions": 0,
      "failureRate": 0,
      "minResponseTime": null,
      "maxResponseTime": null,
      "avgResponseTime": null,
      "lastExecutionTime": null
    },
    "name": "local-mcp-add",
    "gatewaySlug": "local-mcp",
    "originalNameSlug": "add"
  }

🧩 Affected Component

Select the area of the project impacted:

  • mcpgateway - API
  • mcpgateway - UI (admin panel)
  • mcpgateway.wrapper - stdio wrapper
  • Federation or Transports
  • CLI, Makefiles, or shell scripts
  • Container setup (Docker/Podman/Compose)
  • Other (explain below)

🔁 Steps to Reproduce

  1. Register a gateway using the API or UI.
  2. Add or edit a tool with annotations such as "readOnlyHint": true via the admin UI or API. --> also let me know how to properly use command to reflect the annotation badge via the UI as well as via curl
  3. Reload the UI or fetch the tool schema via API.
  4. Observe that the annotations field is empty and the UI does not display annotation hints.

🤔 Expected Behaviour

Annotations should be saved and shown correctly in the UI and included in the tool schema JSON returned by the API.


📓 Logs / Error Output

Logs show successful tool update but annotations are missing in responses and UI.

INFO  [mcpgateway.services.tool_service] Updated tool: local-mcp-calculate-bmi
INFO:     127.0.0.1:60449 - "POST /admin/tools/4c5ad8d18d9b40a39239c487abdfc3aa/edit HTTP/1.1" 200 OK
INFO:     127.0.0.1:60449 - "GET /admin HTTP/1.1" 307 Temporary Redirect
INFO:     127.0.0.1:60449 - "GET /admin/ HTTP/1.1" 200 OK
INFO:     127.0.0.1:60449 - "GET /static/admin.js HTTP/1.1" 304 Not Modified
INFO:     127.0.0.1:60450 - "GET /static/admin.css HTTP/1.1" 304 Not Modified

🧠 Environment Info

Key Value
Version or commit e.g. v0.5.0
Runtime e.g. Python 3.11, Gunicorn

🧩 Additional Context (optional)

  • Please let me know is there any way i can specify the annotation badges while registering the server my mentioning this tool is this badge for a server that brings list of tools.eg. 1 server that has 10 tools , if there is any way i can specifically mention this tools is read-only and this one is destructive etc...

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriageIssues / Features awaiting triage

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions