Skip to main content
Glama
ampcome-mcps

Square Model Context Protocol Server

by ampcome-mcps

get_service_info

Retrieve details about Square API services to understand available endpoints and data structures before making API calls.

Instructions

Get information about a Square API service. Call me before trying to get type info

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serviceYesThe Square API service category (e.g., 'catalog', 'payments')

Implementation Reference

  • Handler function that takes a service name, capitalizes it, looks up the methods in serviceMethodsMap, extracts descriptions, and returns them as JSON. Handles errors by returning error 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:291-334 (registration)
    Registers the 'get_service_info' tool with MCP server, including name, description, input schema (service: string), and 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
          };
        }
      }
    );
  • Zod schema for the tool input: a single 'service' parameter as string.
    {
      service: z.string().describe("The Square API service category (e.g., 'catalog', 'payments')")
    },

Tool Definition Quality

Score is being calculated. Check back soon.

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/ampcome-mcps/square-mcp'

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