proxy_search_traffic
Search captured proxy traffic by URL, headers, and body previews using full-text queries.
Instructions
Full-text search across URLs, headers, and body previews of captured traffic.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search string | |
| limit | No | Max results (default: 20) |
Implementation Reference
- src/index.ts:65-65 (registration)Registration of the traffic tools module (which includes proxy_search_traffic) in the main MCP server setup.
registerTrafficTools(server); - src/tools/traffic.ts:10-10 (registration)Export and function signature for registering all traffic tools, including proxy_search_traffic.
export function registerTrafficTools(server: McpServer): void { - src/tools/traffic.ts:104-134 (handler)Tool handler for proxy_search_traffic: accepts query (string) and limit (number, default 20), calls proxyManager.searchTraffic(query), maps results to summaries, and returns JSON response via truncateResult.
server.tool( "proxy_search_traffic", "Full-text search across URLs, headers, and body previews of captured traffic.", { query: z.string().describe("Search string"), limit: z.number().optional().default(20).describe("Max results (default: 20)"), }, async ({ query, limit }) => { const results = proxyManager.searchTraffic(query).slice(0, limit); const summaries = results.map((t) => ({ id: t.id, timestamp: t.timestamp, method: t.request.method, url: t.request.url, status: t.response?.statusCode ?? null, duration: t.duration ?? null, })); return { content: [{ type: "text", text: truncateResult({ status: "success", query, matches: summaries.length, results: summaries, }), }], }; }, ); - src/tools/traffic.ts:107-110 (schema)Zod schema for proxy_search_traffic: query (required string) and limit (optional number, default 20).
{ query: z.string().describe("Search string"), limit: z.number().optional().default(20).describe("Max results (default: 20)"), }, - src/state.ts:671-687 (helper)Core search logic in ProxyManager.searchTraffic(): case-insensitive full-text search across URLs, request body previews, response body previews, and all header values.
searchTraffic(query: string): CapturedExchange[] { const q = query.toLowerCase(); return this.traffic.filter((t) => { if (t.request.url.toLowerCase().includes(q)) return true; if (t.request.bodyPreview.toLowerCase().includes(q)) return true; if (t.response?.bodyPreview.toLowerCase().includes(q)) return true; for (const v of Object.values(t.request.headers)) { if (v.toLowerCase().includes(q)) return true; } if (t.response) { for (const v of Object.values(t.response.headers)) { if (v.toLowerCase().includes(q)) return true; } } return false; }); }