Agent tools

mcp

mcp({ action: "list" | "get" | "tools" | "disconnect", server?, refresh? })

The MCP servers connected to the account — what is plugged in, which of their tools are allowed, and what those tools cost on every turn. Connecting one is not here.

read, or storage on disconnectno token everdeclarations cost tokens
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

The actions

Free (read)Asked (storage)
list · get · toolsdisconnect
actionstringrequired

list · get · tools · disconnect.

serverstring

The server name, from list. Required by everything but list.

refreshboolean

get: re-read the server's own tool list before answering.

Connecting is not one of the actions

A token never passes through an agent

A connection carries an address and a token. The token is the customer's, it is encrypted at rest, and an agent is the wrong place for it — the same rule that keeps <a href="/sdk/ref/storage/connect">storage.connect()</a> out of the tools. The agent says where to do it instead of trying.

Why an agent needs to see them at all

The allowed tools of a connected server are declared to the model directly, prefixed by the server name, so the agent uses them without knowing where they come from. Asked « which external tools do I have? » it had no answer, and it could not name a server whose tools this run was not given. This tool is that answer.

What is allowed is what is billed

Every allowed tool is declared on every turn of a run that includes its server, and a declaration costs tokens the customer pays for. That is why the allowed list is chosen at connection time and why tools reports what the set weighs.

Reading is free, disconnecting is asked

Removing a server takes a capability away from the account, so it goes through the storage category. Reconnecting needs the token again, which only the user has.

mcp({ action: "list" })
// cloudflare (Cloudflare) · 4 of 11 tools allowed · category exec · mcp.example.com/sse

mcp({ action: "get", server: "cloudflare", refresh: true })
// - dns_record: Write a DNS record
// 7 tools exist on the server and are NOT allowed: the user chose that.
# The Python engine has no mcp management tool; read the same facts from your code
for server in api.mcp.list():
    print(server)
# cloudflare (Cloudflare) · 4 of 11 tools allowed · category exec · mcp.example.com/sse

api.mcp.get("cloudflare")   # the allowed tools and their declarations