get_method_info
Retrieve detailed parameter requirements and usage examples for specific BTCPayServer API methods to ensure correct implementation.
Instructions
Get detailed parameter requirements and examples for a specific service method.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| serviceName | Yes | Service name (e.g., "payment-requests", "invoices", "lightning") | |
| methodName | Yes | Method name (e.g., "create", "get", "list", "delete") |
Implementation Reference
- src/index.ts:209-262 (handler)The main handler for the 'get_method_info' tool. It fetches the service, retrieves its service info, finds the specified method, and constructs a detailed text response with parameters, requirements, and examples.case 'get_method_info': { const serviceName = args?.serviceName as string; const methodName = args?.methodName as string; const service = serviceRegistry.getService(serviceName); if (!service) { return { content: [ { type: 'text', text: `Service "${serviceName}" not found.\n\nAvailable services: ${serviceRegistry.getServiceNames().join(', ')}` } ] }; } const serviceInfo = service.getServiceInfo(); const method = serviceInfo.methods.find(m => m.name === methodName); if (!method) { return { content: [ { type: 'text', text: `Method "${methodName}" not found in service "${serviceName}".\n\nAvailable methods: ${serviceInfo.methods.map(m => m.name).join(', ')}` } ] }; } let output = `**${serviceName}.${methodName}**\n\n${method.description}\n\n`; output += "**Parameters:**\n"; for (const [paramName, paramDef] of Object.entries(method.parameters)) { const required = paramDef.required ? " (required)" : " (optional)"; const defaultVal = paramDef.default !== undefined ? ` [default: ${paramDef.default}]` : ""; output += `• **${paramName}** (${paramDef.type})${required}${defaultVal}: ${paramDef.description}\n`; } if (method.examples && method.examples.length > 0) { output += "\n**Examples:**\n"; method.examples.forEach((example, index) => { output += `\n**${index + 1}. ${example.name}**\n${example.description}\n\`\`\`json\n${JSON.stringify(example.parameters, null, 2)}\n\`\`\`\n`; }); } return { content: [ { type: 'text', text: output } ] }; }
- src/index.ts:100-117 (registration)Registration of the 'get_method_info' tool in the ListTools response, including its name, description, and input schema.{ name: 'get_method_info', description: 'Get detailed parameter requirements and examples for a specific service method.', inputSchema: { type: 'object', properties: { serviceName: { type: 'string', description: 'Service name (e.g., "payment-requests", "invoices", "lightning")' }, methodName: { type: 'string', description: 'Method name (e.g., "create", "get", "list", "delete")' } }, required: ['serviceName', 'methodName'] } },
- src/services/base-service.ts:3-17 (schema)TypeScript interface defining the structure of a ServiceMethod, which is used to provide method details in the tool's response.export interface ServiceMethod { name: string; description: string; parameters: Record<string, { type: string; description: string; required: boolean; default?: any; }>; examples?: Array<{ name: string; description: string; parameters: Record<string, any>; }>; }
- src/services/base-service.ts:58-60 (helper)Helper method in BaseService to retrieve method information by name, implementing the core lookup logic mirrored in the tool handler.protected getMethodInfo(methodName: string): ServiceMethod | undefined { return this.getServiceInfo().methods.find(m => m.name === methodName); }