Skip to main content
Glama
natashanajdovski

Service Health MCP Server

check_http_endpoint

Test HTTP/HTTPS endpoint health by checking connectivity, response time, and status codes. Use this tool to monitor APIs, websites, and web services for availability and performance.

Instructions

Check if an HTTP/HTTPS endpoint is healthy and responsive. This tool will test connectivity, measure response time, and validate status codes. Perfect for monitoring APIs, websites, and web services.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe URL to check (e.g., https://google.com)
methodNoHTTP method to useGET
timeoutNoRequest timeout in milliseconds
expectedStatusNoExpected HTTP status code
headersNoOptional HTTP headers to include

Implementation Reference

  • The primary handler method of the CheckHttpEndpointTool class that validates input parameters, performs the HTTP health check using HttpHealthChecker, handles errors, and returns a formatted response.
    async execute(params: CheckHttpEndpointParams): Promise<string> {
      try {
        // Validate the input parameters
        const validatedParams = CheckHttpEndpointSchema.parse(params);
        
        // Convert to the format our health checker expects
        const checkOptions: HttpCheckOptions = {
          url: validatedParams.url,
          method: validatedParams.method,
          timeout: validatedParams.timeout,
          expectedStatus: validatedParams.expectedStatus,
          headers: validatedParams.headers
        };
    
        // Perform the actual health check
        const result = await this.healthChecker.checkEndpoint(checkOptions);
    
        // Format the response in a way that's helpful for Claude and users
        return this.formatHealthCheckResponse(result);
    
      } catch (error) {
        // Handle validation errors or unexpected issues
        if (error instanceof z.ZodError) {
          const issues = error.errors.map(err => `${err.path.join('.')}: ${err.message}`).join(', ');
          return `❌ Input validation failed: ${issues}`;
        }
        
        return `❌ Unexpected error: ${error instanceof Error ? error.message : 'Unknown error'}`;
      }
    }
  • Zod schema for input validation of the check_http_endpoint tool parameters including URL, method, timeout, expected status, and headers.
    const CheckHttpEndpointSchema = z.object({
      url: SecureUrlSchema
        .describe('The URL to check (e.g., https://google.com)'),
      
      method: z.enum(['GET', 'POST', 'PUT', 'DELETE'])
        .optional()
        .default('GET')
        .describe('HTTP method to use'),
        
      timeout: z.number()
        .min(1000, 'Timeout must be at least 1 second')
        .max(30000, 'Timeout cannot exceed 30 seconds')
        .optional()
        .default(10000)
        .describe('Request timeout in milliseconds'),
        
      expectedStatus: z.number()
        .min(100)
        .max(599)
        .optional()
        .default(200)
        .describe('Expected HTTP status code'),
        
      headers: z.record(z.string())
        .optional()
        .describe('Optional HTTP headers to include')
    });
  • src/server.ts:55-64 (registration)
    MCP server registration of the check_http_endpoint tool via inclusion in the tools/list response using CheckHttpEndpointTool.getDefinition().
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          CheckHttpEndpointTool.getDefinition(),
          // Future tools will be added here:
          // - check_database_connection
          // - check_service_health
          // - get_health_summary
        ],
      };
  • src/server.ts:76-85 (registration)
    Dispatch/execution routing in the MCP tools/call handler for the check_http_endpoint tool, invoking the tool's execute method.
    case 'check_http_endpoint':
        const result = await this.checkHttpTool.execute(args as any || {});            return {
        content: [
          {
            type: 'text',
            text: result,
          },
        ],
      };
  • Helper method that formats the raw health check result into a readable, emoji-enhanced response string for the user.
    private formatHealthCheckResponse(result: any): string {
      const statusEmoji: Record<string, string> = {
        healthy: '✅',
        warning: '⚠️',
        unhealthy: '❌'
      };
      const emoji = statusEmoji[result.status] || '❓';
    
      const response = [
        `${emoji} **Health Check Result**`,
        ``,
        `**URL:** ${result.details?.url}`,
        `**Status:** ${result.status.toUpperCase()}`,
        `**Response Time:** ${result.responseTime}ms`,
      ];
    
      if (result.statusCode) {
        response.push(`**HTTP Status:** ${result.statusCode}`);
      }
    
      response.push(`**Message:** ${result.message}`);
    
      if (result.details?.error) {
        response.push(`**Error Details:** ${result.details.error}`);
      }
    
      response.push(`**Checked At:** ${result.details?.timestamp}`);
    
      // Add interpretation to help users understand the results
      response.push('', '**Interpretation:**');
      if (result.status === 'healthy') {
        response.push('🎉 The endpoint is working perfectly! No issues detected.');
      } else if (result.status === 'warning') {
        response.push('⚠️ The endpoint is responding but may need attention. Check if this is expected behavior.');
      } else {
        response.push('🚨 The endpoint has issues and may be down or misconfigured. Investigation needed.');
      }
    
      return response.join('\n');
    }
Behavior3/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. It describes what the tool does (connectivity testing, response time measurement, status code validation) but doesn't mention important behavioral aspects like whether it follows redirects, handles authentication, includes request bodies, or what happens on timeout. The description adds value but leaves gaps for a monitoring tool.

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 perfectly concise with two sentences that each earn their place. The first sentence states the core functionality, and the second provides usage context. No wasted words, and the most important information (what the tool does) is front-loaded.

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

Completeness3/5

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

For a monitoring tool with 5 parameters, no annotations, and no output schema, the description provides adequate but incomplete context. It covers the 'what' but lacks details about behavioral characteristics, error handling, and output format. The 100% schema coverage helps, but the description should do more to compensate for the lack of annotations and output schema.

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 description doesn't add any parameter-specific information beyond what's already in the schema (which has 100% coverage). It mentions general capabilities like 'measure response time' and 'validate status codes' which relate to the timeout and expectedStatus parameters, but doesn't provide additional semantic context about how these parameters interact or affect the check.

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 tool's purpose with specific verbs ('check', 'test connectivity', 'measure response time', 'validate status codes') and resources ('HTTP/HTTPS endpoint', 'APIs, websites, and web services'). It distinguishes what the tool does from a simple ping by mentioning multiple validation aspects.

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 provides implied usage context ('Perfect for monitoring APIs, websites, and web services') but doesn't explicitly state when to use this tool versus alternatives. With no sibling tools mentioned, this is adequate but lacks explicit guidance about scenarios where this tool might not be appropriate.

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/natashanajdovski/service-health-mcp'

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