Skip to main content
Glama
dkmaker

mcp-function-app-tester

test_endpoint

Test and analyze Azure Function App endpoints by simulating HTTP methods (GET, POST, PUT, DELETE) and inspecting detailed responses. Prepends the base URL http://localhost:7071/api for easy endpoint validation.

Instructions

Test a Function App endpoint and get detailed response information. The endpoint will be prepended to the base url which is: http://localhost:7071/api

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyNoOptional request body for POST/PUT requests
endpointYesEndpoint path (e.g. "/users"). Will be appended to base URL.
headersNoOptional request headers
methodYesHTTP method to use

Implementation Reference

  • The MCP CallToolRequestSchema handler that dispatches to and implements the 'test_endpoint' tool. It validates arguments, configures an Axios request with authentication, normalizes the endpoint, executes the HTTP request, and returns a formatted response including status, headers, and body.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      if (request.params.name !== 'test_endpoint') {
        throw new McpError(
          ErrorCode.MethodNotFound,
          `Unknown tool: ${request.params.name}`
        );
      }
    
      if (!isValidTestEndpointArgs(request.params.arguments)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid test endpoint arguments'
        );
      }
    
      try {
        const config: AxiosRequestConfig = {
          method: request.params.arguments.method as Method,
          url: request.params.arguments.endpoint,
          headers: request.params.arguments.headers || {},
        };
    
        if (['POST', 'PUT'].includes(request.params.arguments.method) && request.params.arguments.body) {
          config.data = request.params.arguments.body;
        }
    
        // Handle authentication based on environment variables
        if (hasBasicAuth()) {
          const base64Credentials = Buffer.from(`${AUTH_BASIC_USERNAME}:${AUTH_BASIC_PASSWORD}`).toString('base64');
          config.headers = {
            ...config.headers,
            'Authorization': `Basic ${base64Credentials}`
          };
        } else if (hasBearerAuth()) {
          config.headers = {
            ...config.headers,
            'Authorization': `Bearer ${AUTH_BEARER}`
          };
        } else if (hasApiKeyAuth()) {
          config.headers = {
            ...config.headers,
            [AUTH_APIKEY_HEADER_NAME as string]: AUTH_APIKEY_VALUE
          };
        }
    
        // Ensure endpoint starts with / and remove any trailing slashes
        const normalizedEndpoint = `/${request.params.arguments.endpoint.replace(/^\/+|\/+$/g, '')}`;
        config.url = normalizedEndpoint;
    
        const response = await this.axiosInstance.request(config);
        const fullUrl = `${BASE_URL}${normalizedEndpoint}`;
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                url: fullUrl, // Include the actual URL called
                statusCode: response.status,
                statusText: response.statusText,
                headers: response.headers,
                body: response.data,
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        if (axios.isAxiosError(error)) {
          return {
            content: [
              {
                type: 'text',
                text: `Request failed: ${error.message}`,
              },
            ],
            isError: true,
          };
        }
        throw error;
      }
    });
  • src/index.ts:70-103 (registration)
    Registration of the 'test_endpoint' tool in the ListToolsRequestSchema handler, including name, description, and input schema.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        {
          name: 'test_endpoint',
          description: `Test a Function App endpoint and get detailed response information. The endpoint will be prepended to the base url which is: ${BASE_URL}`,
          inputSchema: {
            type: 'object',
            properties: {
              method: {
                type: 'string',
                enum: ['GET', 'POST', 'PUT', 'DELETE'],
                description: 'HTTP method to use',
              },
              endpoint: {
                type: 'string',
                description: 'Endpoint path (e.g. "/users"). Will be appended to base URL.',
              },
              body: {
                type: 'object',
                description: 'Optional request body for POST/PUT requests',
              },
              headers: {
                type: 'object',
                description: 'Optional request headers',
                additionalProperties: {
                  type: 'string',
                },
              },
            },
            required: ['method', 'endpoint'],
          },
        },
      ],
    }));
  • JSON Schema defining the input parameters for the 'test_endpoint' tool, including method, endpoint, optional body, and headers.
    inputSchema: {
      type: 'object',
      properties: {
        method: {
          type: 'string',
          enum: ['GET', 'POST', 'PUT', 'DELETE'],
          description: 'HTTP method to use',
        },
        endpoint: {
          type: 'string',
          description: 'Endpoint path (e.g. "/users"). Will be appended to base URL.',
        },
        body: {
          type: 'object',
          description: 'Optional request body for POST/PUT requests',
        },
        headers: {
          type: 'object',
          description: 'Optional request headers',
          additionalProperties: {
            type: 'string',
          },
        },
      },
      required: ['method', 'endpoint'],
    },
  • TypeScript interface defining the expected arguments structure for the 'test_endpoint' tool.
    interface TestEndpointArgs {
      method: 'GET' | 'POST' | 'PUT' | 'DELETE';
      endpoint: string;
      body?: any;
      headers?: Record<string, string>;
    }
  • Type guard function to validate if provided arguments match the TestEndpointArgs interface before executing the tool.
    const isValidTestEndpointArgs = (args: any): args is TestEndpointArgs => {
      if (typeof args !== 'object' || args === null) return false;
      if (!['GET', 'POST', 'PUT', 'DELETE'].includes(args.method)) return false;
      if (typeof args.endpoint !== 'string') return false;
      if (args.headers !== undefined && typeof args.headers !== 'object') return false;
      return true;
    };
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions testing an endpoint and getting 'detailed response information,' but lacks critical behavioral details such as error handling, timeout behavior, authentication requirements, rate limits, or what 'detailed' entails. This is insufficient for a tool that performs HTTP operations.

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

Conciseness4/5

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

The description is concise and front-loaded, consisting of two sentences that directly state the tool's purpose and base URL. There is no wasted text, though it could be slightly more informative without sacrificing brevity.

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 complexity of HTTP testing (4 parameters, no output schema, no annotations), the description is incomplete. It lacks details on response format, error cases, or behavioral traits, leaving significant gaps for an agent to understand how to use the tool effectively.

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 fully documents all parameters. The description adds minimal value by noting the base URL context ('http://localhost:7071/api'), but does not provide additional semantics beyond what the schema already covers. This meets the baseline for high schema coverage.

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: 'Test a Function App endpoint and get detailed response information.' It specifies the verb ('test') and resource ('Function App endpoint'), and mentions the base URL context. However, with no sibling tools, it cannot differentiate from alternatives, so it doesn't reach the highest score.

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, prerequisites, or constraints. It only states what the tool does without context for its application, leaving the agent without usage direction.

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

Related 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/dkmaker/mcp-function-app-tester'

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