bind_api_key_to_agent
Make an API key ACT AS an agent: every call through that key is then that agent — agent-scoped permissions apply, every tool call is recorded against it, and the prediction gate can be switched on. Since v1.96.0 an ordinary MCP client can instead send X-Agent-Id per request — that is PER SESSION, while this binding is shared by every session using the key, so switching it here pulls the identity out from under any session running in parallel. Prefer the header for concurrent sessions; use this for a single long-lived one. Identify the key by api_key_id OR by api_key_name (the name given when it was created — the UI does not show ids). Required: agent_id, or agent_id=null to unbind. REFUSES while the agent has no tool permissions, because agent-scoped checking is fail-closed and binding would otherwise silently disable a working key.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "bind_api_key_to_agent"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | No | ID of the agent | |
| api_key_id | No | ID of the API key | |
| api_key_name | No | Name given to the API key at creation; alternative to api_key_id |