Skip to main content
Glama
code-alchemist01

Development Tools MCP Server

test_api_endpoint

Test API endpoints by sending HTTP requests with configurable methods, headers, and body to verify functionality and responses.

Instructions

Test an API endpoint with HTTP request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesAPI endpoint URL to test
methodNoHTTP methodGET
headersNoHTTP headers
bodyNoRequest body

Implementation Reference

  • Core handler implementation that performs the actual HTTP request to test the API endpoint using axios.
    async testAPIEndpoint(
      url: string,
      options?: { method?: string; headers?: Record<string, string>; body?: unknown }
    ): Promise<{
      status: number;
      statusText: string;
      headers: Record<string, string>;
      body?: unknown;
      responseTime: number;
    }> {
      const axios = (await import('axios')).default;
      const startTime = Date.now();
    
      try {
        const response = await axios({
          url,
          method: (options?.method as any) || 'GET',
          headers: options?.headers,
          data: options?.body,
          validateStatus: () => true,
        });
    
        return {
          status: response.status,
          statusText: response.statusText,
          headers: response.headers as Record<string, string>,
          body: response.data,
          responseTime: Date.now() - startTime,
        };
      } catch (error) {
        throw new Error(`Failed to test endpoint: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • Input schema definition for the test_api_endpoint tool, specifying parameters like url, method, headers, and body.
    inputSchema: {
      type: 'object',
      properties: {
        url: {
          type: 'string',
          description: 'API endpoint URL to test',
        },
        method: {
          type: 'string',
          enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS', 'HEAD'],
          description: 'HTTP method',
          default: 'GET',
        },
        headers: {
          type: 'object',
          description: 'HTTP headers',
        },
        body: {
          type: 'object',
          description: 'Request body',
        },
      },
      required: ['url'],
    },
  • Tool registration in the apiDiscoveryTools array, including name, description, and input schema.
    {
      name: 'test_api_endpoint',
      description: 'Test an API endpoint with HTTP request',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'API endpoint URL to test',
          },
          method: {
            type: 'string',
            enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS', 'HEAD'],
            description: 'HTTP method',
            default: 'GET',
          },
          headers: {
            type: 'object',
            description: 'HTTP headers',
          },
          body: {
            type: 'object',
            description: 'Request body',
          },
        },
        required: ['url'],
      },
    },
  • Dispatcher handler case in handleAPIDiscoveryTool that extracts parameters and delegates to APIScraper.testAPIEndpoint.
    case 'test_api_endpoint': {
      const url = params.url as string;
      const method = params.method as string;
      const headers = params.headers as Record<string, string>;
      const body = params.body as unknown;
      const result = await apiScraper.testAPIEndpoint(url, { method, headers, body });
      return result;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but offers minimal information. It mentions HTTP request testing but doesn't describe what 'testing' entails (e.g., whether it validates responses, checks status codes, measures performance, or handles authentication). There's no mention of rate limits, error handling, or output format, leaving significant gaps for a tool that interacts with external systems.

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?

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It's appropriately sized for a straightforward tool and front-loads the core purpose. Every word earns its place, making it easy for an agent to parse quickly.

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

Completeness2/5

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

Given the tool's complexity (interacting with external APIs via HTTP) and lack of annotations or output schema, the description is insufficient. It doesn't explain what constitutes a 'test', what the tool returns (e.g., response data, status codes, errors), or behavioral aspects like timeouts or retries. For a 4-parameter tool with no structured safety or output information, this leaves the agent under-informed.

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?

The input schema has 100% description coverage, so parameters are well-documented in the schema itself. The description adds no additional semantic context about parameters beyond implying they're used for HTTP requests. This meets the baseline of 3 since the schema does the heavy lifting, but the description doesn't enhance understanding of how parameters interact or their practical use.

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

Purpose4/5

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

The description clearly states the tool's purpose as 'Test an API endpoint with HTTP request', which specifies the verb (test) and resource (API endpoint). It distinguishes itself from sibling tools like 'discover_api_endpoints' or 'extract_api_schema' by focusing on testing rather than discovery or extraction. However, it doesn't explicitly differentiate from potential overlapping tools like 'analyze_network_requests'.

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?

The description provides no guidance on when to use this tool versus alternatives. While the purpose is clear, there's no mention of specific use cases, prerequisites, or comparisons to sibling tools like 'analyze_network_requests' or 'scrape_with_interaction' that might also involve HTTP requests. The agent must infer usage context from the tool name alone.

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/code-alchemist01/development-tools-mcp-Server'

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