Skip to main content
Glama

health

Verify the operational status of the Headlesshost API to ensure system connectivity and functionality.

Instructions

Check the health status of the Headlesshost API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:205-236 (registration)
    Registration of the 'health' MCP tool, including empty input schema and inline handler that fetches health status from the Headlesshost API (/tools/health) and returns the JSON response or error.
    server.registerTool( "health", { title: "Health Check", description: "Check the health status of the Headlesshost API", inputSchema: {}, }, async () => { try { const response: AxiosResponse<ApiResponse> = await apiClient.get("/tools/health"); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: handleApiError(error), }, ], isError: true, }; } } );
  • The handler function for the 'health' tool: performs a GET request to the API's /tools/health endpoint, returns the response as formatted JSON text, or an error message using handleApiError if the request fails.
    async () => { try { const response: AxiosResponse<ApiResponse> = await apiClient.get("/tools/health"); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: handleApiError(error), }, ], isError: true, }; } }
  • Utility helper function used by the health tool handler (and others) to format and return API error messages as strings.
    function handleApiError(error: any): string { if (error.response) { return `API Error ${error.response.status}: ${error.response.data?.message || error.response.statusText}`; } else if (error.request) { return "Network Error: Unable to reach API server"; } else { return `Error: ${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/Headlesshost/mcp-server'

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