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'] }

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