Skip to main content
Glama
Switchboard666

HaloPSA MCP Server

halopsa_table_info

Retrieve table structure details including columns, data types, nullable fields, and relationships to understand HaloPSA database schema for effective query planning.

Instructions

Get detailed information about a specific HaloPSA table including all columns, data types, nullable fields, and relationship suggestions. Use this to understand table structure before writing queries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableNameYesName of the table to inspect. Example: FAULTS, USERS, SITE, ACTIONS, REQUESTTYPE

Implementation Reference

  • The handler function for 'halopsa_table_info' tool. It validates the tableName input, constructs a SQL query to fetch column information from INFORMATION_SCHEMA.COLUMNS, processes the results into a structured format including position, name, type, maxLength, nullable, and default values. Adds hardcoded common relationships for popular tables and returns formatted JSON with an example query.
    case 'halopsa_table_info': {
      const { tableName } = args as any;
      if (!tableName) {
        throw new Error('Table name is required');
      }
      
      const escapedTable = tableName.replace(/'/g, "''");
      const sql = `
        SELECT 
          c.COLUMN_NAME,
          c.DATA_TYPE,
          c.CHARACTER_MAXIMUM_LENGTH,
          c.IS_NULLABLE,
          c.COLUMN_DEFAULT,
          c.ORDINAL_POSITION
        FROM INFORMATION_SCHEMA.COLUMNS c
        WHERE LOWER(c.TABLE_NAME) = '${escapedTable.toLowerCase()}'
        ORDER BY c.ORDINAL_POSITION
      `;
      
      result = await haloPSAClient.executeQuery(sql);
      
      const columns: any[] = [];
      if (result?.report?.rows && Array.isArray(result.report.rows)) {
        result.report.rows.forEach((row: any) => {
          columns.push({
            position: row.ORDINAL_POSITION,
            name: row.COLUMN_NAME,
            type: row.DATA_TYPE,
            maxLength: row.CHARACTER_MAXIMUM_LENGTH,
            nullable: row.IS_NULLABLE === 'YES',
            default: row.COLUMN_DEFAULT
          });
        });
      }
      
      const commonRelationships: Record<string, string[]> = {
        'FAULTS': ['USERS (via userid)', 'SITE (via siteid)', 'ACTIONS (via faultid)'],
        'USERS': ['FAULTS (via userid)', 'SITE (via siteid)'],
        'SITE': ['CLIENT (via clientid)', 'FAULTS (via siteid)', 'USERS (via siteid)'],
        'ACTIONS': ['FAULTS (via faultid)', 'USERS (via whoagentid)'],
        'CLIENT': ['SITE (via clientid)']
      };
      
      return {
        content: [{
          type: 'text',
          text: JSON.stringify({
            table: tableName,
            columns,
            columnCount: columns.length,
            possibleRelationships: commonRelationships[tableName.toUpperCase()] || [],
            exampleQuery: `SELECT TOP 10 * FROM ${tableName}`
          }, null, 2)
        }]
      };
    }
  • src/index.ts:93-106 (registration)
    Tool registration entry in the MCP tools array. Defines the name, description, and input schema (requiring 'tableName' parameter) for the 'halopsa_table_info' tool, used by the ListTools handler.
    {
      name: 'halopsa_table_info',
      description: 'Get detailed information about a specific HaloPSA table including all columns, data types, nullable fields, and relationship suggestions. Use this to understand table structure before writing queries.',
      inputSchema: {
        type: 'object',
        properties: {
          tableName: {
            type: 'string',
            description: 'Name of the table to inspect. Example: FAULTS, USERS, SITE, ACTIONS, REQUESTTYPE'
          }
        },
        required: ['tableName']
      }
    },
  • Input schema definition for the halopsa_table_info tool, specifying an object with a required 'tableName' string property.
    inputSchema: {
      type: 'object',
      properties: {
        tableName: {
          type: 'string',
          description: 'Name of the table to inspect. Example: FAULTS, USERS, SITE, ACTIONS, REQUESTTYPE'
        }
      },
      required: ['tableName']
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the tool's function well but lacks details on potential limitations like rate limits, authentication requirements, error handling, or whether it's read-only (implied by 'Get' but not explicit). It adds value by specifying the type of metadata returned, but more behavioral context would be helpful.

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 efficiently structured in two sentences: the first states the purpose and details, and the second provides usage guidance. Every sentence adds value without redundancy, making it front-loaded and appropriately sized for the tool's complexity.

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 moderate complexity (single parameter, no output schema, no annotations), the description is mostly complete. It covers the purpose, usage context, and metadata details, but lacks information on output format or behavioral traits like error cases. With no output schema, some guidance on return values would enhance completeness, but it's adequate for a schema inspection tool.

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?

The input schema has 100% description coverage, with the single parameter 'tableName' well-documented in the schema. The description doesn't add any additional meaning beyond what the schema provides, such as examples or constraints not in the schema. Baseline 3 is appropriate since 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 specific action ('Get detailed information') and resource ('about a specific HaloPSA table'), with explicit details about what information is retrieved ('all columns, data types, nullable fields, and relationship suggestions'). It distinguishes from siblings like halopsa_list_tables (which lists tables) and halopsa_list_columns (which lists columns without detailed metadata).

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool ('to understand table structure before writing queries'), which implicitly suggests it's for schema exploration rather than data retrieval. However, it doesn't explicitly state when not to use it or name specific alternatives among the siblings, such as halopsa_get_api_schemas or halopsa_list_columns for different needs.

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