Skip to main content
Glama

health_check

Verify WebSim API connectivity to ensure the service is operational and accessible for project browsing, content discovery, and community interactions.

Instructions

Check if the WebSim API is accessible

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "type": "object" }

Implementation Reference

  • The handler function for the 'health_check' tool. It attempts to make a GET request to the WebSim API's projects endpoint to verify connectivity. Returns a JSON response indicating 'healthy' if successful or 'unhealthy' with error details if failed.
    handler: async (args) => { try { // Try to access a simple endpoint to test connectivity await apiClient.makeRequest('/api/v1/projects', { method: 'GET' }); return { content: [{ type: "text", text: JSON.stringify({ success: true, status: "healthy", message: "WebSim API is accessible", timestamp: new Date().toISOString() }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ success: false, status: "unhealthy", message: `WebSim API is not accessible: ${error.message}`, timestamp: new Date().toISOString() }, null, 2) }] }; } }
  • server.js:1079-1115 (registration)
    The 'health_check' tool registration within the tools array used by the MCP server for listing and calling tools.
    { name: "health_check", description: "Check if the WebSim API is accessible", inputSchema: { type: "object", properties: {} }, handler: async (args) => { try { // Try to access a simple endpoint to test connectivity await apiClient.makeRequest('/api/v1/projects', { method: 'GET' }); return { content: [{ type: "text", text: JSON.stringify({ success: true, status: "healthy", message: "WebSim API is accessible", timestamp: new Date().toISOString() }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ success: false, status: "unhealthy", message: `WebSim API is not accessible: ${error.message}`, timestamp: new Date().toISOString() }, null, 2) }] }; } } }
  • The input schema for the 'health_check' tool, which requires no parameters (empty object).
    inputSchema: { type: "object", properties: {} },
  • The makeRequest method of WebSimAPIClient class, used by the health_check handler to perform the API connectivity test.
    async makeRequest(endpoint, options = {}) { const url = `${this.baseURL}${endpoint}`; try { const controller = new AbortController(); const timeoutId = setTimeout(() => controller.abort(), this.timeout); const response = await fetch(url, { ...options, signal: controller.signal, headers: { 'Content-Type': 'application/json', ...options.headers } }); clearTimeout(timeoutId); if (!response.ok) { throw new Error(`HTTP ${response.status}: ${response.statusText}`); } return await response.json(); } catch (error) { if (error.name === 'AbortError') { throw new Error(`Request timeout after ${this.timeout}ms`); } throw new Error(`API request failed: ${error.message}`); } }

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/gigachadtrey/websimm'

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