get_service_info
Retrieve essential details about a specific Square API service, such as 'catalog' or 'payments', to facilitate informed API usage and integration planning.
Instructions
Get information about a Square API service. Call me before trying to get type info
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| service | Yes | The Square API service category (e.g., 'catalog', 'payments') |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"service": {
"description": "The Square API service category (e.g., 'catalog', 'payments')",
"type": "string"
}
},
"required": [
"service"
],
"type": "object"
}
Implementation Reference
- server.ts:297-333 (handler)The handler function for the 'get_service_info' tool. It takes a service name, capitalizes it, looks up the methods in serviceMethodsMap, extracts descriptions, and returns them as JSON text content.async (params) => { try { const { service } = params; const serviceName = service.charAt(0).toUpperCase() + service.slice(1); const methods = serviceMethodsMap[serviceName]; if (!methods) { throw new Error(`Invalid service: ${service}. Available services: ${JSON.stringify(Object.keys(serviceMethodsMap), null, 2)}`); } // Create a map of method names to their descriptions const methodInfo = Object.entries(methods).reduce((acc, [methodName, info]) => { acc[methodName] = { description: info.description }; return acc; }, {} as Record<string, { description: string }>); return { content: [{ type: "text", text: JSON.stringify(methodInfo, null, 2) }] }; } catch (err: any) { return { content: [{ type: "text", text: JSON.stringify({ error: err.message, details: err.errors || err.stack }, null, 2) }], isError: true }; } }
- server.ts:294-296 (schema)Input schema for the 'get_service_info' tool, defining a required 'service' string parameter.{ service: z.string().describe("The Square API service category (e.g., 'catalog', 'payments')") },
- server.ts:291-334 (registration)Registration of the 'get_service_info' MCP tool on the McpServer instance, including description, input schema, and inline handler function.server.tool( "get_service_info", "Get information about a Square API service. Call me before trying to get type info", { service: z.string().describe("The Square API service category (e.g., 'catalog', 'payments')") }, async (params) => { try { const { service } = params; const serviceName = service.charAt(0).toUpperCase() + service.slice(1); const methods = serviceMethodsMap[serviceName]; if (!methods) { throw new Error(`Invalid service: ${service}. Available services: ${JSON.stringify(Object.keys(serviceMethodsMap), null, 2)}`); } // Create a map of method names to their descriptions const methodInfo = Object.entries(methods).reduce((acc, [methodName, info]) => { acc[methodName] = { description: info.description }; return acc; }, {} as Record<string, { description: string }>); return { content: [{ type: "text", text: JSON.stringify(methodInfo, null, 2) }] }; } catch (err: any) { return { content: [{ type: "text", text: JSON.stringify({ error: err.message, details: err.errors || err.stack }, null, 2) }], isError: true }; } } );