Skip to main content
Glama
Switchboard666

HaloPSA MCP Server

halopsa_api_call

Execute authenticated API calls to HaloPSA endpoints for managing tickets, actions, and other PSA data operations using HTTP methods like GET, POST, PUT, PATCH, and DELETE.

Instructions

Make authenticated API calls to any HaloPSA endpoint. Use this after finding the right endpoint with schema tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAPI endpoint path (e.g., "/api/Ticket", "/api/Actions")
methodNoHTTP method to useGET
bodyNoRequest body data for POST/PUT/PATCH requests
queryParamsNoURL query parameters as key-value pairs

Implementation Reference

  • MCP tool handler that validates input, calls haloPSAClient.makeApiCall with parameters, and formats the response as MCP content.
    case 'halopsa_api_call': {
      const { path, method, body, queryParams } = args as any;
      if (!path) {
        throw new Error('API path is required');
      }
      
      result = await haloPSAClient.makeApiCall(path, method || 'GET', body, queryParams);
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(result, null, 2)
        }]
      };
    }
  • Input schema definition and tool registration in the tools array, defining parameters for path, method, body, and queryParams.
    name: 'halopsa_api_call',
    description: 'Make authenticated API calls to any HaloPSA endpoint. Use this after finding the right endpoint with schema tools.',
    inputSchema: {
      type: 'object',
      properties: {
        path: {
          type: 'string',
          description: 'API endpoint path (e.g., "/api/Ticket", "/api/Actions")'
        },
        method: {
          type: 'string',
          enum: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'],
          description: 'HTTP method to use',
          default: 'GET'
        },
        body: {
          type: 'object',
          description: 'Request body data for POST/PUT/PATCH requests'
        },
        queryParams: {
          type: 'object',
          description: 'URL query parameters as key-value pairs',
          additionalProperties: { type: 'string' }
        }
      },
      required: ['path']
    }
  • src/index.ts:278-281 (registration)
    Registration of the tools list handler, making the halopsa_api_call tool discoverable via ListToolsRequestSchema.
    // Handler for listing tools
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
  • Core helper function implementing the authenticated HTTP request to HaloPSA API endpoints using fetch, handling authentication, query parameters, request body, and response parsing.
    async makeApiCall(
      path: string, 
      method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' = 'GET',
      body?: any,
      queryParams?: Record<string, string>
    ): Promise<any> {
      // Ensure we have a valid token
      await this.authenticate();
    
      // Build the full URL
      let url = `${this.config.url}${path}`;
      
      // Add tenant to query params
      const params = new URLSearchParams({ tenant: this.config.tenant });
      
      // Add additional query parameters if provided
      if (queryParams) {
        Object.entries(queryParams).forEach(([key, value]) => {
          if (value !== undefined && value !== null) {
            params.append(key, value);
          }
        });
      }
      
      const paramString = params.toString();
      if (paramString) {
        url += (path.includes('?') ? '&' : '?') + paramString;
      }
    
      const options: RequestInit = {
        method,
        headers: {
          'accept': 'application/json',
          'authorization': `Bearer ${this.accessToken}`,
          'Content-Type': 'application/json'
        }
      };
    
      if (body && (method === 'POST' || method === 'PUT' || method === 'PATCH')) {
        options.body = typeof body === 'object' ? JSON.stringify(body) : body;
      }
    
      try {
        const response = await fetch(url, options);
        
        if (!response.ok) {
          const errorText = await response.text();
          throw new Error(`API call failed: ${response.status} - ${errorText}`);
        }
    
        const contentType = response.headers.get('content-type');
        if (contentType && contentType.includes('application/json')) {
          return await response.json();
        } else {
          return await response.text();
        }
      } catch (error) {
        throw new Error(`Failed to make API call: ${error}`);
      }
    }
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. It discloses authentication ('authenticated API calls') and hints at behavioral context by referencing schema tools for endpoint discovery. However, it lacks details on rate limits, error handling, response formats, or specific authentication methods, which are important for a general-purpose API call tool.

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 front-loaded and concise, consisting of two sentences that efficiently convey the tool's purpose and usage guidelines without any wasted words. Every sentence adds value, making it easy for an agent to understand the tool's role quickly.

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 the tool's complexity (general API calls with 4 parameters) and lack of annotations and output schema, the description is somewhat complete but has gaps. It covers purpose and usage well but omits details on authentication specifics, response handling, and error scenarios, which are crucial for effective tool invocation in this context.

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 already documents all parameters (path, method, body, queryParams). The description adds no additional parameter semantics beyond what the schema provides, such as examples of common endpoints or guidance on when to use body vs. queryParams. This meets the baseline of 3 for high schema coverage.

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: 'Make authenticated API calls to any HaloPSA endpoint.' It specifies the verb ('Make authenticated API calls') and resource ('any HaloPSA endpoint'), and distinguishes it from siblings by mentioning 'after finding the right endpoint with schema tools,' which references tools like halopsa_get_api_endpoint_details or halopsa_search_api_endpoints.

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 guidance: 'Use this after finding the right endpoint with schema tools.' This indicates when to use this tool (for making API calls) versus alternatives (schema tools for endpoint discovery), and it names sibling tools implicitly, offering clear context for tool 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/Switchboard666/halopsa-mcp'

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