Skip to main content
Glama

ping

Test authentication and connection to the Headlesshost API to verify system accessibility and operational status.

Instructions

Test authentication and connection to the Headlesshost API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:171-202 (registration)
    Registration of the "ping" MCP tool, including schema (empty input), title, description, and inline handler that proxies to the Headlesshost API /tools/ping endpoint, returning JSON response or error.
    server.registerTool( "ping", { title: "Ping API", description: "Test authentication and connection to the Headlesshost API", inputSchema: {}, }, async () => { try { const response: AxiosResponse<ApiResponse> = await apiClient.get("/tools/ping"); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: handleApiError(error), }, ], isError: true, }; } } );
  • Handler function for "ping" tool: sends GET request to API /tools/ping, formats response as text content block, handles errors using handleApiError and marks as error.
    async () => { try { const response: AxiosResponse<ApiResponse> = await apiClient.get("/tools/ping"); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: handleApiError(error), }, ], isError: true, }; } }
  • Schema definition for "ping" tool: title, description, and empty inputSchema (no parameters required).
    { title: "Ping API", description: "Test authentication and connection to the Headlesshost API", inputSchema: {},
  • Helper function handleApiError used by the "ping" handler (and others) to format API error responses.
    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