Files
genai-toolbox/internal/server
Yuan Teoh 0b3dac4132 feat: add metadata in MCP Manifest for Toolbox auth (#1395)
Add `_meta` for `tools/list` method in MCP Toolbox.

If there are authorized invocation, the following will be return in
`_meta`:
```
{
    "name":"my-tool-name",
    "description":"my tool description",
     "inputSchema":{
        "type":"object",
         "properties":{
             "user_id":{"type":"string","description":"user's name from google login"}
         },
         "required":["user_id"]
     },
     "_meta":{
         "toolbox/authParam":{"user_id":["my_auth"]}
     }
}
```

If there are authenticated parameter, the following will be return in
`_meta`:
```
{
    "name":"my-tool-name",
    "description":"my tool description",
    "inputSchema":{
        "type":"object",
        "properties":{
            "sql":{"type":"string","description":"The sql to execute."}
        },
        "required":["sql"]
    },
    "_meta":{
        "toolbox/authInvoke":["my_auth"]
    }
}
```

If there are no authorized invocation or authenticated prameter, the
`_meta` field will be omitted.


With this feature, the following were updated in the source code: 
* In each `func(p CommonParameter) McpManifest()`, we will return a
`[]string` for the list of authenticated parameters. This is similar to
how Manifest() return the list of authNames in non-MCP Toolbox's
manifest.
* The `func(ps Parameters) McpManifest()` will return a
`map[string][]string` that with key as param's name, and value as the
param's auth.
* Added a new function `GetMcpManifest()` in `tools.go`. This function
will consctruct the McpManifest, and add the `Metadata` field.
* Associated tests were added or updated.
2025-09-26 17:48:57 -07:00
..