Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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 ), }, ], }; } }
  • 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: {}, }, }, ], }; });
Install Server

Other Tools

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/CodaLabs-xyz/Template-x402-Mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server