service_info
Retrieve X402 API service details including available endpoints, pricing information, and payment requirements for making micropayment-based API calls.
Instructions
Get information about the X402 API service including available endpoints, pricing, and payment requirements
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.ts:258-307 (handler)Handler function for the 'service_info' tool. Fetches X402 service discovery metadata from the /.well-known/x402 endpoint using axios. Returns structured JSON with service info or fallback basic connection details if the endpoint is unavailable.case "service_info": { // Fetch service discovery metadata from /.well-known/x402 try { const response = await axios.get(`${baseURL}/.well-known/x402`); return { content: [ { type: "text", text: JSON.stringify( { service_discovery: true, ...response.data, connection_info: { base_url: baseURL, payment_enabled: paymentEnabled, network: network, }, }, null, 2 ), }, ], }; } catch (error: any) { // If service discovery not available, return basic info return { content: [ { type: "text", text: JSON.stringify( { service_discovery: false, message: "Service discovery endpoint not available", connection_info: { base_url: baseURL, payment_enabled: paymentEnabled, network: network, }, note: "API may not support X402 protocol or /.well-known/x402 endpoint", }, null, 2 ), }, ], }; } }
- index.ts:133-136 (schema)Input schema definition for the 'service_info' tool. Defines an empty object (no required input parameters).inputSchema: { type: "object", properties: {}, },
- index.ts:130-137 (registration)Registration of the 'service_info' tool in the ListToolsRequestSchema handler response. Includes name, description, and input schema.{ name: "service_info", description: "Get information about the X402 API service including available endpoints, pricing, and payment requirements", inputSchema: { type: "object", properties: {}, }, },