Skip to main content
Glama

Send HTTP Request

send_http_request

Send HTTP requests through HTTP Toolkit for interception and debugging. Monitor requests and responses in real-time to analyze traffic and troubleshoot issues.

Instructions

Send an HTTP request through the HTTP Toolkit proxy. The request will be intercepted and visible in the HTTP Toolkit UI. Returns the full response including status code, headers, and body.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodYesHTTP method (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS)
urlYesFull URL to send the request to
headersNoRequest headers as array of [name, value] pairs. Host header is auto-added if missing.
bodyNoRequest body as a string
ignoreHostHttpsErrorsNoHostnames to ignore HTTPS errors for, or true to ignore all

Implementation Reference

  • The HttpToolkitClient.sendHttpRequest method performs the actual HTTP request by communicating with the HTTP Toolkit REST API (/client/send), processes the resulting NDJSON stream, and returns a formatted JSON string of the response.
    async sendHttpRequest(
      request: RequestDefinition,
      options: SendRequestOptions
    ): Promise<string> {
      const url = `${this.baseUrl}/client/send`;
      const body = {
        request: {
          ...request,
          rawBody: request.rawBody
            ? Buffer.from(request.rawBody).toString('base64')
            : '',
        },
        options,
      };
    
      const res = await fetch(url, {
        method: 'POST',
        headers: this.headers,
        body: JSON.stringify(body),
      });
    
      if (!res.ok) {
        const errorBody = await res.text();
        throw new Error(`HTTP Toolkit send request failed (${res.status}): ${errorBody}`);
      }
    
      // Read the NDJSON stream and collect all events
      const text = await res.text();
      const events = text
        .split('\n')
        .filter((line) => line.trim())
        .map((line) => JSON.parse(line));
    
      // Build a readable response summary
      const responseHead = events.find((e: any) => e.type === 'response-head');
      const bodyParts = events.filter((e: any) => e.type === 'response-body-part');
      const error = events.find((e: any) => e.type === 'error');
    
      if (error) {
        throw new Error(`Request failed: ${error.error?.message || JSON.stringify(error)}`);
      }
    
      const responseBody = bodyParts
        .map((p: any) => Buffer.from(p.rawBody, 'base64').toString('utf-8'))
        .join('');
    
      const result: Record<string, unknown> = {};
      if (responseHead) {
        result.statusCode = responseHead.statusCode;
        result.statusMessage = responseHead.statusMessage;
        result.headers = responseHead.headers;
      }
      result.body = responseBody;
    
      return JSON.stringify(result, null, 2);
    }
  • src/index.ts:333-364 (registration)
    The send_http_request tool is registered here, defining the input schema and the handler that calls the underlying client.sendHttpRequest method.
    server.registerTool(
      'send_http_request',
      {
        title: 'Send HTTP Request',
        description:
          'Send an HTTP request through the HTTP Toolkit proxy. The request will be intercepted and visible in the HTTP Toolkit UI. Returns the full response including status code, headers, and body.',
        inputSchema: z.object({
          method: z.string().describe('HTTP method (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS)'),
          url: z.string().describe('Full URL to send the request to'),
          headers: z
            .array(z.tuple([z.string(), z.string()]))
            .optional()
            .describe('Request headers as array of [name, value] pairs. Host header is auto-added if missing.'),
          body: z.string().optional().describe('Request body as a string'),
          ignoreHostHttpsErrors: z
            .union([z.array(z.string()), z.boolean()])
            .optional()
            .describe('Hostnames to ignore HTTPS errors for, or true to ignore all'),
        }),
      },
      async ({ method, url, headers, body, ignoreHostHttpsErrors }) => {
        const requestDef = {
          method,
          url,
          headers: headers || [['Host', new URL(url).host]],
          rawBody: body,
        };
        const options = { ignoreHostHttpsErrors };
        const result = await client.sendHttpRequest(requestDef, options);
        return { content: [{ type: 'text' as const, text: result }] };
      }
    );
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: the proxy interception mechanism, visibility in the UI, and the full response structure returned. It doesn't mention error handling, timeout behavior, or authentication requirements, but covers the core operational behavior adequately for a tool with no annotations.

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?

Perfectly concise with two sentences that each earn their place: the first states the core action and context, the second describes the return value. No wasted words, front-loaded with the main purpose, and appropriately sized for the tool's complexity.

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?

Given the tool's moderate complexity (5 parameters, no output schema, no annotations), the description provides good contextual completeness. It covers the purpose, operational context (proxy interception), and return format. The main gap is the lack of an output schema, but the description compensates by specifying what's returned. For a mutation tool (sending requests) with no annotations, it could benefit from more safety/error context.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all 5 parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no parameter information in the description.

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 clearly states the specific action ('Send an HTTP request'), specifies the resource ('through the HTTP Toolkit proxy'), and distinguishes this tool from all sibling tools which focus on interception setup, configuration, or traffic capture rather than direct HTTP request execution. It provides a complete purpose statement in the first sentence.

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

Usage Guidelines3/5

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

The description implies usage context by mentioning 'through the HTTP Toolkit proxy' and that requests 'will be intercepted and visible in the HTTP Toolkit UI,' suggesting this tool is for testing/monitoring scenarios. However, it doesn't explicitly state when to use this versus alternatives or provide any exclusion criteria. The guidance is contextual but not explicit.

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/fdciabdul/httptoolkit-mcp'

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