Search and code mode
An agent reads the whole tool list when it connects. For a small API that is the right shape: one tool per endpoint, each with its schema. For a large one, the list alone can fill the agent's context before it has done anything. GitHub's public spec, 1,209 operations, lists at about 403,000 tokens as separate tools and about 1,500 in search mode.
How agents see the tools in MCP Studio sets the shape.
| Mode | What the agent lists |
|---|---|
| Automatic | Every tool up to the threshold, then search. The default |
| Every tool | One tool per endpoint, whatever the size |
| Search | A few tools that find, describe and call your endpoints |
| Code | Two tools for writing and running a short script against your SDK |
The documentation tools are listed in every mode.
Search mode
The agent gets these tools in place of the endpoint list:
| Tool | What it does |
|---|---|
search_tools | Finds tools by what they do, in a few words. Takes query, group, limit and offset. Returns 10 by default, and up to 25 |
describe_tool | Returns the full schema for up to five tools by name |
call_tool | Calls one of them by name with its arguments |
list_tool_groups | Lists how the operations are organized, with a few examples of each |
What it looks like
This is a real session, on an API with 281 operations. The agent searches:
search_tools { "query": "create a file", "limit": 3 }
78 operations of 281 match "create a file" (showing 1 to 3):
createFile · POST /files · Upload a file that can be used across various
endpoints. · requires: body · asks the user first
CreateContainerFile · POST /containers/{container_id}/files · Create a
Container File · requires: containerId · asks the user first
createVectorStoreFile · POST /vector_stores/{vector_store_id}/files · Create a
vector store file. · requires: vectorStoreId, body · asks the user first
Next: describe_tool with the names you need, then call_tool. Pass offset 3 for more.It then reads the one it wants:
describe_tool { "names": ["createFile"] }
## createFile
POST /files · group: Files · asks the user to approve each call · can change or delete data
Upload a file that can be used across various endpoints...And finally calls it with call_tool.
A call through call_tool goes through the same permissions, approval prompt and limits as a direct call, and shows in your usage under the tool's real name. Chained tools are searchable and callable the same way.
Switch to search above sets the threshold for Automatic. It starts at 40 visible tools.
The agent only finds a tool through its name and description. Write them in the words people use.
Code mode
In code mode the agent lists describe_sdk, which shows your SDK's methods, and run_code, which runs a short TypeScript or Python script with a ready client:
const open = await client.invoices.list({ status: "open" });
return open.filter((invoice) => invoice.dueDate < "2026-11-01").length;A list, a filter and a dozen follow-up calls come back as one answer, and only that answer lands in the agent's context.
Scripts run in a sandbox whose only way out is the SDK. Every SDK call inside a script goes through the same path as a tool call: permissions, approval prompts, practice answers, error guides and usage. So a script can do nothing its tools could not, and asks for everything they would ask for.
| Limit | Value |
|---|---|
| SDK calls per run | 50 |
| Approval prompts per run | 10 |
| Script length | 20,000 characters |
| Running time | 30 seconds. Time waiting on your API doesn't count |
| Memory | 64 MB |
| Printed output | 8 KB |
| Returned result | 24 KB |
Turn it on with Turn on code mode and choose the languages under Code mode languages. Code mode is available from the Starter plan. If the sandbox cannot start on a machine, the server falls back to search mode.
Choosing per connection
The person connecting can override your choice for their own connection:
- Hosted: add
?tool_mode=search(orall,code,auto) to the server URL. - Local:
--tool-mode searchorOCTRI_TOOL_MODE=search.
Their choice wins over yours, and yours wins over Automatic.