Skip to main content
Glama
Switchboard666

HaloPSA MCP Server

halopsa_list_columns

Retrieve column details for any HaloPSA database table, including data types, lengths, and nullable status to understand table structure and plan queries effectively.

Instructions

List columns for a specific table in the HaloPSA database using information_schema.columns. Returns detailed column information including data types, max length, and nullable status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableNameYesTable name to get columns for. Example: FAULTS, USERS, SITE
columnFilterNoOptional filter to search for specific column names. Example: "id", "name", "date"

Implementation Reference

  • The main execution handler for 'halopsa_list_columns' tool within the CallToolRequestSchema switch statement. Builds dynamic SQL query against INFORMATION_SCHEMA.COLUMNS using provided tableName and optional columnFilter, executes via HaloPSAClient, processes results into structured columnsByTable object, and returns formatted JSON response.
    case 'halopsa_list_columns': {
      const { tableName, columnFilter } = args as any;
      
      if (!tableName) {
        throw new Error('Table name is required');
      }
      
      let sql = `
        SELECT 
          c.TABLE_NAME,
          c.COLUMN_NAME,
          c.DATA_TYPE,
          c.CHARACTER_MAXIMUM_LENGTH,
          c.IS_NULLABLE,
          c.COLUMN_DEFAULT
        FROM INFORMATION_SCHEMA.COLUMNS c
      `;
      
      const conditions: string[] = [];
      const escapedTable = tableName.replace(/'/g, "''");
      conditions.push(`LOWER(c.TABLE_NAME) = '${escapedTable.toLowerCase()}'`);
      
      if (columnFilter) {
        const escapedFilter = columnFilter.replace(/'/g, "''");
        conditions.push(`LOWER(c.COLUMN_NAME) LIKE '%${escapedFilter.toLowerCase()}%'`);
      }
      
      if (conditions.length > 0) {
        sql += ' WHERE ' + conditions.join(' AND ');
      }
      
      sql += ' ORDER BY c.TABLE_NAME, c.ORDINAL_POSITION';
      
      result = await haloPSAClient.executeQuery(sql);
      
      const columnsByTable: Record<string, any[]> = {};
      if (result?.report?.rows && Array.isArray(result.report.rows)) {
        result.report.rows.forEach((row: any) => {
          const table = row.TABLE_NAME;
          if (!columnsByTable[table]) {
            columnsByTable[table] = [];
          }
          columnsByTable[table].push({
            name: row.COLUMN_NAME,
            type: row.DATA_TYPE,
            maxLength: row.CHARACTER_MAXIMUM_LENGTH,
            nullable: row.IS_NULLABLE === 'YES',
            default: row.COLUMN_DEFAULT
          });
        });
      }
      
      return {
        content: [{
          type: 'text',
          text: JSON.stringify({
            columnsByTable,
            totalTables: Object.keys(columnsByTable).length,
            totalColumns: result?.report?.rows?.length || 0,
            filters: {
              table: tableName || 'none',
              column: columnFilter || 'none'
            }
          }, null, 2)
        }]
      };
    }
  • The tool definition and input schema for 'halopsa_list_columns', registered in the tools array used by ListToolsRequestSchema handler. Specifies name, description, and validation schema requiring tableName with optional columnFilter.
    {
      name: 'halopsa_list_columns',
      description: 'List columns for a specific table in the HaloPSA database using information_schema.columns. Returns detailed column information including data types, max length, and nullable status.',
      inputSchema: {
        type: 'object',
        properties: {
          tableName: {
            type: 'string',
            description: 'Table name to get columns for. Example: FAULTS, USERS, SITE'
          },
          columnFilter: {
            type: 'string',
            description: 'Optional filter to search for specific column names. Example: "id", "name", "date"'
          }
        },
        required: ['tableName']
      }
    },
  • src/index.ts:279-281 (registration)
    General tool registration handler that returns the full tools array (including halopsa_list_columns) when ListToolsRequestSchema is called.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
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. It discloses the return format ('detailed column information including data types, max length, and nullable status'), which is helpful behavioral context. However, it doesn't mention potential limitations like rate limits, authentication needs, or error conditions, leaving gaps for a read operation.

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 a single, well-structured sentence that efficiently conveys purpose, method, and return details without waste. It's appropriately sized and front-loaded with the core action.

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 (2 parameters, read-only operation), no annotations, and no output schema, the description is reasonably complete. It covers purpose, method, and return format, but could improve by addressing authentication or error handling. The lack of output schema is partially compensated by describing return content.

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 both parameters thoroughly. The description doesn't add any parameter-specific semantics beyond what's in the schema (e.g., it doesn't clarify tableName format beyond examples or columnFilter matching behavior). 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 specific action ('List columns') and resource ('for a specific table in the HaloPSA database'), and distinguishes from siblings like halopsa_list_tables (which lists tables) and halopsa_table_info (which may provide different table metadata). The mention of 'using information_schema.columns' adds technical specificity.

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 when needing column details for a table, but doesn't explicitly state when to use this tool versus alternatives like halopsa_get_api_schemas or halopsa_query. It mentions the source (information_schema.columns) which provides some context, but lacks explicit guidance on exclusions or prerequisites.

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