Skip to main content
Glama

health_check

Verify the operational status of the GASSAPI MCP server to ensure it's running correctly and ready for API management tasks.

Instructions

Check if the MCP server is running properly

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The asynchronous handler function that executes the health_check tool logic. It computes server uptime, memory usage, lists available tools, and returns a formatted status response or error.
    [healthCheckTool.name]: async (args: Record<string, any>) => { try { const uptime = process.uptime(); const memory = process.memoryUsage(); const status = { server: 'GASSAPI MCP Client', version: '1.0.0', status: 'healthy', timestamp: new Date().toISOString(), uptime: uptime, memory: memory, tools: ALL_TOOLS.map(t => t.name), migration_status: 'Refactoring Complete - Modular Structure Implemented' }; return { content: [ { type: 'text', text: `✅ GASSAPI MCP Server Status\n\n${JSON.stringify(status, null, 2)}` } ] }; } catch (error) { return { content: [ { type: 'text', text: `❌ Health check failed: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } }
  • The tool definition including name, description, and input schema (empty object). Used in ALL_TOOLS export.
    export const healthCheckTool: McpTool = { name: 'health_check', description: 'Check if the MCP server is running properly', inputSchema: { type: 'object', properties: {} } };
  • src/server.ts:90-97 (registration)
    Registers the health_check handler via createAllToolHandlers() into toolHandlers map and registers the tool object from ALL_TOOLS into the server's tools Map and availableTools array.
    this.toolHandlers = createAllToolHandlers(); // Initialize tools immediately for consistency ALL_TOOLS.forEach(tool => { this.tools.set(tool.name, tool); }); this.availableTools = ALL_TOOLS; this.toolsLoaded = true;
  • src/server.ts:134-152 (registration)
    Fallback registration in case of tool loading error: defines a minimal healthCheckTool and registers it exclusively to ensure server functionality.
    const healthCheckTool = { name: 'health_check', description: 'Check if the MCP server is running properly', inputSchema: { type: 'object', properties: {} } }; this.tools.clear(); this.tools.set(healthCheckTool.name, healthCheckTool); this.availableTools = [healthCheckTool]; this.toolsLoaded = true; logger.warn('Using fallback tool registration', { toolsCount: this.tools.size, tools: Array.from(this.tools.keys()), module: 'McpServer' });
  • Legacy or alternative handler method in McpServer class (not actively used in toolHandlers routing). Provides similar health check logic.
    private async handleHealthCheck(args: Record<string, any>): Promise<any> { try { const uptime = (Date.now() - this.startTime) / 1000; const memory = process.memoryUsage(); // Ensure tools are loaded await this.ensureToolsLoaded(); const status = { server: 'GASSAPI MCP Client', version: '1.0.0', status: 'healthy', timestamp: new Date().toISOString(), uptime: uptime, memory: memory, tools: Array.from(this.tools.keys()), migration_status: 'Step 1 - Core Framework Migrated' }; return { content: [ { type: 'text', text: `✅ GASSAPI MCP Server Status\n\n${JSON.stringify(status, null, 2)}` } ] }; } catch (error) { return { content: [ { type: 'text', text: `❌ Health check failed: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } }

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/martin-1103/mcp2'

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