Skip to main content
Glama

proxy_clear_traffic

Clear all captured traffic from the proxy buffer to reset captured data for a fresh start.

Instructions

Clear all captured traffic from the buffer.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler for the proxy_clear_traffic tool. Calls proxyManager.clearTraffic() and returns JSON with 'cleared' count.
    server.tool(
      "proxy_clear_traffic",
      "Clear all captured traffic from the buffer.",
      {},
      async () => {
        const count = proxyManager.clearTraffic();
        return {
          content: [{
            type: "text",
            text: JSON.stringify({ status: "success", cleared: count }),
          }],
        };
      },
    );
  • src/index.ts:65-65 (registration)
    The proxy_clear_traffic tool is registered when registerTrafficTools(server) is called during server setup.
    registerTrafficTools(server);
  • The registerTrafficTools function registers proxy_clear_traffic (and the other 3 traffic tools) on the MCP server.
    export function registerTrafficTools(server: McpServer): void {
      server.tool(
        "proxy_list_traffic",
        "List captured HTTP exchanges with optional filters. Returns paginated results.",
        {
          limit: z.number().optional().default(50).describe("Max entries to return (default: 50)"),
          offset: z.number().optional().default(0).describe("Skip first N entries (default: 0)"),
          method_filter: z.string().optional().describe("Filter by HTTP method (e.g., GET, POST)"),
          url_filter: z.string().optional().describe("Filter by URL substring"),
          status_filter: z.number().optional().describe("Filter by response status code"),
          hostname_filter: z.string().optional().describe("Filter by hostname substring"),
          source_filter: z.enum(["explicit", "transparent"]).optional().describe("Filter by traffic source: 'explicit' (proxy-configured) or 'transparent' (iptables-redirected)"),
        },
        async ({ limit, offset, method_filter, url_filter, status_filter, hostname_filter, source_filter }) => {
          let traffic = proxyManager.getTraffic();
    
          if (method_filter) {
            const m = method_filter.toUpperCase();
            traffic = traffic.filter((t) => t.request.method === m);
          }
          if (url_filter) {
            const u = url_filter.toLowerCase();
            traffic = traffic.filter((t) => t.request.url.toLowerCase().includes(u));
          }
          if (status_filter !== undefined) {
            traffic = traffic.filter((t) => t.response?.statusCode === status_filter);
          }
          if (hostname_filter) {
            const h = hostname_filter.toLowerCase();
            traffic = traffic.filter((t) => t.request.hostname.toLowerCase().includes(h));
          }
          if (source_filter) {
            traffic = traffic.filter((t) => t.source === source_filter);
          }
    
          const total = traffic.length;
          const page = traffic.slice(offset, offset + limit);
    
          // Create summary view (no body previews to save space)
          const summaries = page.map((t) => ({
            id: t.id,
            timestamp: t.timestamp,
            source: t.source ?? "explicit",
            method: t.request.method,
            url: t.request.url,
            hostname: t.request.hostname,
            status: t.response?.statusCode ?? null,
            duration: t.duration ?? null,
            requestSize: t.request.bodySize,
            responseSize: t.response?.bodySize ?? null,
            ...(t.tls?.client?.ja3Fingerprint ? { ja3: t.tls.client.ja3Fingerprint } : {}),
            ...(t.tls?.client?.ja4Fingerprint ? { ja4: t.tls.client.ja4Fingerprint } : {}),
          }));
    
          return {
            content: [{
              type: "text",
              text: truncateResult({
                status: "success",
                total,
                // `count` is the historical alias kept for callers (and the
                // integration test) that read the post-filter total under that
                // name. Same value as `total`; do not diverge.
                count: total,
                offset,
                limit,
                showing: summaries.length,
                exchanges: summaries,
              }),
            }],
          };
        },
      );
    
      server.tool(
        "proxy_get_exchange",
        "Get full details of a captured HTTP exchange including headers and body previews.",
        {
          exchange_id: z.string().describe("Exchange ID from proxy_list_traffic"),
        },
        async ({ exchange_id }) => {
          const exchange = proxyManager.getExchange(exchange_id);
          if (!exchange) {
            return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: `Exchange '${exchange_id}' not found` }) }] };
          }
          return {
            content: [{
              type: "text",
              text: truncateResult({ status: "success", exchange }),
            }],
          };
        },
      );
    
      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,
              }),
            }],
          };
        },
      );
    
      server.tool(
        "proxy_clear_traffic",
        "Clear all captured traffic from the buffer.",
        {},
        async () => {
          const count = proxyManager.clearTraffic();
          return {
            content: [{
              type: "text",
              text: JSON.stringify({ status: "success", cleared: count }),
            }],
          };
        },
      );
    }
  • The schema for proxy_clear_traffic is an empty object (no input parameters).
    {},
  • The ProxyManager.clearTraffic() helper method called by the handler. Clears the in-memory traffic ring buffer, pending requests, and pending raw bodies, returning the count of cleared items.
    clearTraffic(): number {
      const count = this.traffic.length;
      this.traffic.length = 0;
      this.pendingRequests.clear();
      this.pendingRawBodies.clear();
      return count;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Minimal disclosure beyond the verb 'clear', which implies destruction but lacks details on side effects, reversibility, or impact on other tool states. No annotations to supplement.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise single sentence that communicates the core function with no waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter tool, the description is adequate, though it lacks behavioral nuance. Could mention that traffic is permanently cleared, but not necessary for basic understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist, so the description does not need to add parameter semantics. Baseline score of 4 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description specifies a clear action ('clear') and resource ('captured traffic from the buffer'), distinguishing it from sibling tools like proxy_list_traffic or proxy_export_har.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives. Does not mention prerequisites, side effects, or when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yfe404/proxy-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server