Reads the exact code you need from one file instead of dumping the whole file into context.
DESCRIPTION
Use read_code when you already know the file you care about and need the real implementation of one or more symbols. It is the narrowest code-reading tool in the set.
GOOD FIT
AVOID IT WHEN
| Name | Type | Required | Description |
|---|---|---|---|
| path | string | Yes | Absolute path to the file you want to inspect. |
| symbols | string[] | No | Specific function, class, or type names to extract. Omit to read the important exports. |
PATH PARAMETER
Pass the absolute path to a specific file, not just the repo root. If you are working on a remote machine, use the path on that machine. If the file does not exist or is outside the accessible project tree, the tool returns a direct error. This tool reads code from the file path you provide; it does not pull source files from private GitHub URLs.
PRECISION
Large service files often contain many helpers that are irrelevant to your change. read_code narrows the response to the symbols you asked for, which keeps both the code and the caller context much tighter than pasting an entire 500-line file into a chat.
{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "read_code", "arguments": { "path": "/Users/name/projects/zephex/dashboard/src/lib/auth.ts", "symbols": ["validateApiKey"] } }}Symbol: validateApiKeySignature: validateApiKey(apiKey: string)Imports: crypto, Supabase admin clientBehavior: hashes the candidate key, checks revocation, expiry, and tierRelevant callers: dashboard/src/app/api/mcp/route.ts, dashboard/src/app/api/user/tool-preferences/route.tsTOKEN EFFICIENCY
A focused symbol extraction is usually around 300 to 900 tokens. Reading the entire file plus neighboring callers is often 1,500 to 8,000 tokens, so this tool typically keeps the cost to about 10 to 35 percent of a manual read.