health_check
Verify X402 API service availability and response status to ensure the production-ready micropayment system is operational for AI agents.
Instructions
Check if the X402 API service is available and responding
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.ts:309-353 (handler)The handler function for the 'health_check' tool. It attempts to GET /health from the configured API baseURL, returns healthy status with response data if successful, or error status if failed.case "health_check": { try { // Try health endpoint const response = await axios.get(`${baseURL}/health`, { timeout: 5000 }); return { content: [ { type: "text", text: JSON.stringify( { status: "healthy", api_url: baseURL, payment_enabled: paymentEnabled, network: network, response: response.data, }, null, 2 ), }, ], }; } catch (error: any) { return { content: [ { type: "text", text: JSON.stringify( { status: "error", api_url: baseURL, payment_enabled: paymentEnabled, network: network, error: error.message, note: "API may be down or health endpoint not available", }, null, 2 ), }, ], }; } }
- index.ts:138-145 (registration)The registration of the 'health_check' tool in the ListTools response, including its name, description, and empty input schema.{ name: "health_check", description: "Check if the X402 API service is available and responding", inputSchema: { type: "object", properties: {}, }, },
- index.ts:141-144 (schema)The input schema for the 'health_check' tool, which requires no parameters (empty object).inputSchema: { type: "object", properties: {}, },