const tools = await client.listTools();
// [{ name: "search_docs", description: "…", inputSchema: { … } }]tools = client.list_tools()
# [{"name": "search_docs", "description": "…", "inputSchema": {…}}]It follows the pages
Up to twenty of them. Past that it stops with what it has — a server that paginates for ever would otherwise hold the call open until the timeout.
The schemas are raw
They are exactly what the server declared, references and unusual constructs included. A provider that refuses one fails the whole turn. Run them through sanitizeSchema() — or use api.mcp.tools(), which has already done it.
The schema can ask for headers
A tool may annotate parameters that must travel as HTTP headers rather than in the body. Those annotations are read only along a direct chain of properties — one placed under a construct that could branch makes the tool's definition invalid, because there would be no single path to read in the arguments.
Initialise first
The handshake settles the revision, which decides what the listing call must carry. Calling this first is an error the server will report rather than a convenience.
The account's version
get(name, { refresh: true }) does this and records the result, keeping your allowed list untouched.