Skip to main content
Glama
Switchboard666

HaloPSA MCP Server

halopsa_get_api_schemas

Retrieve API schema definitions from HaloPSA to understand request and response object structures for API endpoints, with filtering and pagination support.

Instructions

Get API schemas/models from the swagger definition. Shows the structure of request/response objects used by the API endpoints. Supports pagination.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
schemaPatternNoOptional pattern to filter schemas by name (e.g., "Ticket", "Action", "Client")
limitNoMaximum number of schemas to return (default: 50)
skipNoNumber of matching schemas to skip for pagination (default: 0)
listNamesNoInclude list of all matching schema names (default: false, auto-included if ≤20 matches)

Implementation Reference

  • Core handler implementation that loads the OpenAPI swagger.json, extracts components.schemas, applies filtering by schemaPattern, pagination with limit/skip, and returns structured schema data with metadata.
    async getApiSchemas(
      schemaPattern?: string, 
      limit: number = 50, 
      skip: number = 0,
      listNames: boolean = false
    ): Promise<any> {
      try {
        // Import the swagger.json directly
        const swaggerModule = await import('./swagger.json');
        const schema = swaggerModule.default || swaggerModule;
        
        const schemas: any = {};
        const matchingSchemaNames: string[] = [];
        let schemaCount = 0;
        let skippedCount = 0;
        
        if ((schema as any).components?.schemas) {
          const allSchemas = (schema as any).components.schemas;
          
          Object.entries(allSchemas).forEach(([name, schemaObj]: [string, any]) => {
            // Filter by pattern if provided
            if (schemaPattern && !name.toLowerCase().includes(schemaPattern.toLowerCase())) {
              return;
            }
            
            matchingSchemaNames.push(name);
            
            // Skip logic
            if (skippedCount < skip) {
              skippedCount++;
              return;
            }
            
            if (schemaCount >= limit) {
              return;
            }
            
            schemas[name] = schemaObj;
            schemaCount++;
          });
        }
        
        // Get total count of all schemas
        const totalSchemaCount = (schema as any).components?.schemas ? 
          Object.keys((schema as any).components.schemas).length : 0;
        
        const result: any = {
          schemas,
          returnedCount: schemaCount,
          matchingCount: matchingSchemaNames.length,
          totalSchemasInAPI: totalSchemaCount,
          skipped: skip,
          limited: schemaCount >= limit,
          hasMore: skip + schemaCount < matchingSchemaNames.length,
          message: schemaPattern ? 
            `Showing ${schemaCount} of ${matchingSchemaNames.length} schemas matching "${schemaPattern}" (skipped ${skip})` : 
            `Showing ${schemaCount} schemas starting from position ${skip}. Total: ${totalSchemaCount}.`
        };
        
        // Only include schema names if requested or if there are few enough
        if (listNames || matchingSchemaNames.length <= 20) {
          result.schemaNames = matchingSchemaNames.sort();
        } else {
          result.hint = `${matchingSchemaNames.length} schemas match. Set listNames=true to see all names.`;
        }
        
        return result;
      } catch (error) {
        throw new Error(`Failed to get API schemas: ${error}`);
      }
    }
  • src/index.ts:219-246 (registration)
    MCP tool registration defining the name, description, and input schema validation for halopsa_get_api_schemas.
    {
      name: 'halopsa_get_api_schemas',
      description: 'Get API schemas/models from the swagger definition. Shows the structure of request/response objects used by the API endpoints. Supports pagination.',
      inputSchema: {
        type: 'object',
        properties: {
          schemaPattern: {
            type: 'string',
            description: 'Optional pattern to filter schemas by name (e.g., "Ticket", "Action", "Client")'
          },
          limit: {
            type: 'number',
            description: 'Maximum number of schemas to return (default: 50)',
            default: 50
          },
          skip: {
            type: 'number',
            description: 'Number of matching schemas to skip for pagination (default: 0)',
            default: 0
          },
          listNames: {
            type: 'boolean',
            description: 'Include list of all matching schema names (default: false, auto-included if ≤20 matches)',
            default: false
          }
        }
      }
    },
  • MCP server request handler switch case that parses tool arguments and delegates to HaloPSAClient.getApiSchemas method.
    case 'halopsa_get_api_schemas': {
      const { schemaPattern, limit, skip, listNames } = args as any;
      result = await haloPSAClient.getApiSchemas(schemaPattern, limit, skip, listNames);
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(result, null, 2)
        }]
      };
    }
  • Input schema definition for validating tool parameters: schemaPattern, limit, skip, listNames.
    inputSchema: {
      type: 'object',
      properties: {
        schemaPattern: {
          type: 'string',
          description: 'Optional pattern to filter schemas by name (e.g., "Ticket", "Action", "Client")'
        },
        limit: {
          type: 'number',
          description: 'Maximum number of schemas to return (default: 50)',
          default: 50
        },
        skip: {
          type: 'number',
          description: 'Number of matching schemas to skip for pagination (default: 0)',
          default: 0
        },
        listNames: {
          type: 'boolean',
          description: 'Include list of all matching schema names (default: false, auto-included if ≤20 matches)',
          default: false
        }
      }
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses pagination behavior and that it 'Shows the structure,' implying a read-only operation, but lacks details on permissions, rate limits, error handling, or response format. It adds some context but leaves significant behavioral traits unspecified.

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

Conciseness4/5

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

The description is front-loaded with the core purpose in the first sentence, followed by supporting details. It uses three concise sentences with zero waste, though it could be slightly more structured by explicitly separating purpose from features.

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

Completeness3/5

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

Given 4 parameters with full schema coverage but no annotations or output schema, the description is adequate for a read operation but incomplete. It covers purpose and pagination but lacks details on authentication, errors, or return values, leaving gaps for an AI agent to invoke it correctly in complex scenarios.

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%, so the schema fully documents all 4 parameters. The description adds no parameter-specific semantics beyond what's in the schema (e.g., no extra examples or constraints), resulting in a baseline score of 3 as the schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the verb ('Get') and resource ('API schemas/models from the swagger definition') with specific scope ('structure of request/response objects used by the API endpoints'). It distinguishes from siblings like halopsa_list_api_endpoints by focusing on schema structure rather than endpoint listing, though not explicitly contrasting them.

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

Usage Guidelines3/5

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

The description implies usage for understanding API object structures, but provides no explicit guidance on when to use this tool versus alternatives like halopsa_get_api_endpoint_details or halopsa_search_api_endpoints. The mention of pagination support hints at context for large datasets, but lacks clear when/when-not directives.

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/Switchboard666/halopsa-mcp'

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