Skip to main content
Glama
square

Square Model Context Protocol Server

Official
by square

get_type_info

Retrieve type information for Square API methods to ensure proper data formatting before making API requests. This tool helps developers prepare correct parameters for services like catalog, payments, and inventory management.

Instructions

Get type information for a Square API method. You must call this before calling the make_api_request tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serviceYesThe Square API service category (e.g., 'catalog', 'payments')
methodYesThe API method to call (e.g., 'list', 'create')

Implementation Reference

  • server.ts:240-288 (registration)
    Full registration of the 'get_type_info' MCP tool, including description, Zod input schema, and inline async handler that resolves service/method to requestTypeName from serviceMethodsMap and returns type info from typeMap as JSON.
    server.tool(
      "get_type_info",
      "Get type information for a Square API method. You must call this before calling the make_api_request tool.",
      {
        service: z.string().describe("The Square API service category (e.g., 'catalog', 'payments')"),
        method: z.string().describe("The API method to call (e.g., 'list', 'create')")
      },
      async (params) => {
        try {
          const { service, method } = 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)}`);
          }
    
          if (!methods[method]) {
            throw new Error(`Invalid method ${method} for service ${service}. Available methods: ${JSON.stringify(Object.keys(methods), null, 2)}`);
          }
    
          const methodInfo = methods[method];
          const requestTypeName = methodInfo.requestType;
          
          const typeInfo = typeMap[requestTypeName];
          if (!typeInfo) {
            throw new Error(`Type information not found for ${requestTypeName}`);
          }
    
          return {
            content: [{
              type: "text",
              text: JSON.stringify(typeInfo, null, 2)
            }]
          };
        } catch (err: any) {
          return {
            content: [{
              type: "text",
              text: JSON.stringify({
                error: err.message,
                details: err.errors || err.stack
              }, null, 2)
            }],
            isError: true
          };
        }
      }
    );
  • The core handler logic for get_type_info: validates service and method against serviceMethodsMap, retrieves requestType, fetches typeInfo from typeMap, and returns as JSON text content or error.
    async (params) => {
      try {
        const { service, method } = 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)}`);
        }
    
        if (!methods[method]) {
          throw new Error(`Invalid method ${method} for service ${service}. Available methods: ${JSON.stringify(Object.keys(methods), null, 2)}`);
        }
    
        const methodInfo = methods[method];
        const requestTypeName = methodInfo.requestType;
        
        const typeInfo = typeMap[requestTypeName];
        if (!typeInfo) {
          throw new Error(`Type information not found for ${requestTypeName}`);
        }
    
        return {
          content: [{
            type: "text",
            text: JSON.stringify(typeInfo, 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 input schema defining required string parameters 'service' and 'method' for the get_type_info tool.
    {
      service: z.string().describe("The Square API service category (e.g., 'catalog', 'payments')"),
      method: z.string().describe("The API method to call (e.g., 'list', 'create')")
    },
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the prerequisite relationship with 'make_api_request,' which adds useful context, but it does not describe other behavioral traits such as whether this is a read-only operation, potential rate limits, error handling, or what the output looks like. The description adds some value but lacks comprehensive behavioral details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with two concise sentences that directly state the purpose and usage guidelines without any wasted words. Every sentence earns its place by providing essential information, making it efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (simple read operation with 2 parameters), high schema coverage (100%), and no output schema, the description is mostly complete. It covers the purpose and usage context well, but it lacks details on behavioral aspects like output format or error handling, which could be helpful since no annotations or output schema are provided. It's adequate but has minor gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, meaning the input schema already fully documents the two parameters ('service' and 'method') with clear descriptions. The description does not add any additional meaning or semantics beyond what the schema provides, such as examples or constraints not in the schema. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('type information for a Square API method'), and it distinguishes from siblings by explicitly mentioning the relationship with 'make_api_request' tool. The purpose is not a tautology of the name and provides meaningful context about what type information is being retrieved.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidelines by stating 'You must call this before calling the make_api_request tool,' which clearly indicates when to use this tool (as a prerequisite) and distinguishes it from alternatives like 'get_service_info' by specifying its role in the API call workflow. This gives clear context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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