ping
Verify the availability of the Bitrefill API to ensure readiness for cryptocurrency-based product search and shopping.
Instructions
Check if the Bitrefill API is available
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/handlers/tools.ts:407-432 (handler)The 'ping' tool registration and inline handler function. Registers the tool with MCP server and implements the logic to ping the API via MiscService and return formatted response or error.server.tool( "ping", "Check if the Bitrefill API is available", {}, async () => { try { const ping = await MiscService.ping(); return { content: [ { type: "text" as const, text: JSON.stringify(ping, null, 2) } ] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: "text" as const, text: JSON.stringify({ error: errorMessage }, null, 2), }, ], isError: true, }; } } );
- src/schemas/misc.ts:6-19 (schema)Zod schema (PingResponseSchema) and TypeScript type (PingResponse) for validating the ping API response used by the tool./** * Ping response schema */ export const PingResponseSchema = z.object({ meta: z.object({ _endpoint: z.string(), }), message: z.string().describe("Ping response message"), }); /** * Ping response type */ export type PingResponse = z.infer<typeof PingResponseSchema>;
- src/services/misc.ts:21-27 (helper)Helper method in MiscService that performs the ping by delegating to the authenticated API client./** * Ping the API to check if it's available * @returns Ping response */ public static async ping(): Promise<PingResponse> { return authenticatedApiClient.ping(); }