service_info
Retrieve X402 API service details including endpoints, pricing, and payment requirements to understand available functionality and costs.
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)The handler for the 'service_info' tool. Fetches X402 service discovery metadata from the /.well-known/x402 endpoint using axios, falls back to basic connection info if unavailable, and returns formatted JSON response.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:130-137 (schema)Tool schema definition for 'service_info', including name, description, and empty input schema (no parameters required). This is part of the tools list returned by listTools.{ name: "service_info", description: "Get information about the X402 API service including available endpoints, pricing, and payment requirements", inputSchema: { type: "object", properties: {}, }, },
- index.ts:106-148 (registration)Registration of the 'service_info' tool via the listTools handler, which returns the list of available tools including their schemas.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: "example_api_call", description: "Example tool for making X402-protected API calls. Replace with your actual API endpoints.", inputSchema: { type: "object", properties: { query: { type: "string", description: "Example query parameter - customize for your API", }, limit: { type: "number", description: "Optional: Maximum number of results to return", minimum: 1, maximum: 100, default: 10, }, }, required: ["query"], }, }, { name: "service_info", description: "Get information about the X402 API service including available endpoints, pricing, and payment requirements", inputSchema: { type: "object", properties: {}, }, }, { name: "health_check", description: "Check if the X402 API service is available and responding", inputSchema: { type: "object", properties: {}, }, }, ], }; });