Skip to main content
Glama
InsForge

Insforge MCP Server

get-table-schema

Retrieve detailed table schema including RLS policies, indexes, and constraints to understand database structure and implement secure data access.

Instructions

Returns the detailed schema(including RLS, indexes, constraints, etc.) of a specific table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apiKeyNoAPI key for authentication (optional if provided via --api_key)
tableNameYesName of the table

Implementation Reference

  • The handler function for the 'get-table-schema' tool. It fetches the detailed table schema from the backend API endpoint `/api/metadata/{tableName}` using the provided or global API key, processes the response with handleApiResponse, adds optional background context, formats the output, and handles errors gracefully.
      withUsageTracking('get-table-schema', async ({ apiKey, tableName }) => {
        try {
          const actualApiKey = getApiKey(apiKey);
          const response = await fetch(`${API_BASE_URL}/api/metadata/${tableName}`, {
            method: 'GET',
            headers: {
              'x-api-key': actualApiKey,
            },
          });
    
          const result = await handleApiResponse(response);
    
          return await addBackgroundContext({
            content: [
              {
                type: 'text',
                text: formatSuccessMessage('Schema retrieved', result),
              },
            ],
          });
        } catch (error) {
          const errMsg = error instanceof Error ? error.message : 'Unknown error occurred';
          return {
            content: [
              {
                type: 'text',
                text: `Error getting table schema: ${errMsg}`,
              },
            ],
            isError: true,
          };
        }
      })
    );
  • Input schema validation using Zod schemas for the tool parameters: optional 'apiKey' string and required 'tableName' string.
    {
      apiKey: z
        .string()
        .optional()
        .describe('API key for authentication (optional if provided via --api_key)'),
      tableName: z.string().describe('Name of the table'),
    },
  • Registration of the 'get-table-schema' tool on the MCP server within the registerInsforgeTools function, including name, description, input schema, and wrapped handler.
    server.tool(
      'get-table-schema',
      'Returns the detailed schema(including RLS, indexes, constraints, etc.) of a specific table',
      {
        apiKey: z
          .string()
          .optional()
          .describe('API key for authentication (optional if provided via --api_key)'),
        tableName: z.string().describe('Name of the table'),
      },
      withUsageTracking('get-table-schema', async ({ apiKey, tableName }) => {
        try {
          const actualApiKey = getApiKey(apiKey);
          const response = await fetch(`${API_BASE_URL}/api/metadata/${tableName}`, {
            method: 'GET',
            headers: {
              'x-api-key': actualApiKey,
            },
          });
    
          const result = await handleApiResponse(response);
    
          return await addBackgroundContext({
            content: [
              {
                type: 'text',
                text: formatSuccessMessage('Schema retrieved', result),
              },
            ],
          });
        } catch (error) {
          const errMsg = error instanceof Error ? error.message : 'Unknown error occurred';
          return {
            content: [
              {
                type: 'text',
                text: `Error getting table schema: ${errMsg}`,
              },
            ],
            isError: true,
          };
        }
      })
    );
Behavior2/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 of behavioral disclosure. It states the tool returns detailed schema including RLS, indexes, and constraints, which adds some context beyond a basic 'get schema' statement. However, it lacks information on permissions needed, rate limits, error handling, or response format, which are critical for a tool with no annotations.

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, efficient sentence that front-loads the core purpose ('Returns the detailed schema') and includes key details (RLS, indexes, constraints) without waste. Every word earns its place, making it appropriately sized and well-structured.

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 moderate complexity (retrieving schema details), no annotations, and no output schema, the description is partially complete. It specifies what schema details are included, which helps, but lacks information on authentication, error cases, or return structure. This leaves gaps that could hinder an agent's ability to use the tool effectively.

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 input schema already documents both parameters (apiKey and tableName) fully. The description adds no additional meaning beyond what the schema provides, such as explaining tableName format or apiKey usage scenarios. Baseline is 3 when schema does the heavy lifting, but no extra value is added.

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 ('Returns') and resource ('detailed schema of a specific table'), specifying what the tool does. It distinguishes from siblings by focusing on table schema retrieval rather than operations like bulk-upsert or run-raw-sql. However, it doesn't explicitly differentiate from get-backend-metadata or get-function, which might also return metadata, making it a 4 rather than a 5.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to prefer get-table-schema over get-backend-metadata for schema details or when to use it in conjunction with other tools like run-raw-sql. There's no explicit context or exclusions provided, leaving usage unclear.

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/InsForge/insforge-mcp'

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