Skip to main content
Glama
isaacgounton

SQLite MCP Server

describe_table

Retrieve the schema of a table, including columns, types, constraints, indexes, and foreign keys.

Instructions

Get the schema of a table: columns, types, constraints, indexes, and foreign keys.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_nameYesName of the table to describe

Implementation Reference

  • The handler for the 'describe_table' tool: validates the table name, then queries PRAGMA table_info, index_list, and foreign_key_list to return the table schema.
    case 'describe_table': {
      const { table_name } = toolArgs as { table_name: string };
      validateTableName(table_name);
      const columns = db.all(`PRAGMA table_info("${table_name}")`);
      const indexes = db.all(`PRAGMA index_list("${table_name}")`);
      const foreignKeys = db.all(`PRAGMA foreign_key_list("${table_name}")`);
      return {
        content: [{ type: 'text', text: JSON.stringify({ columns, indexes, foreign_keys: foreignKeys }, null, 2) }],
      };
    }
  • The tool registration/schema definition: defines 'describe_table' with a required 'table_name' string parameter.
    {
      name: 'describe_table',
      description: 'Get the schema of a table: columns, types, constraints, indexes, and foreign keys.',
      inputSchema: {
        type: 'object' as const,
        properties: {
          table_name: { type: 'string', description: 'Name of the table to describe' },
        },
        required: ['table_name'],
      },
    },
  • src/index.ts:197-274 (registration)
    Registration of all tools via ListToolsRequestSchema handler, including 'describe_table' in the tools list.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        {
          name: 'read_query',
          description: 'Execute a read-only SQL query (SELECT, WITH/CTE, or EXPLAIN). Use this for fetching data.',
          inputSchema: {
            type: 'object' as const,
            properties: {
              query: { type: 'string', description: 'The SELECT SQL query to execute' },
            },
            required: ['query'],
          },
        },
        {
          name: 'write_query',
          description: 'Execute a data modification query (INSERT, UPDATE, DELETE, REPLACE). Returns affected row count.',
          inputSchema: {
            type: 'object' as const,
            properties: {
              query: { type: 'string', description: 'The SQL modification query to execute' },
            },
            required: ['query'],
          },
        },
        {
          name: 'create_table',
          description: 'Create a new table in the database with a full CREATE TABLE SQL statement.',
          inputSchema: {
            type: 'object' as const,
            properties: {
              query: { type: 'string', description: 'CREATE TABLE SQL statement' },
            },
            required: ['query'],
          },
        },
        {
          name: 'drop_table',
          description: 'Drop (delete) a table from the database. This action is irreversible.',
          inputSchema: {
            type: 'object' as const,
            properties: {
              table_name: { type: 'string', description: 'Name of the table to drop' },
            },
            required: ['table_name'],
          },
        },
        {
          name: 'list_tables',
          description: 'List all user-created tables in the database.',
          inputSchema: {
            type: 'object' as const,
            properties: {},
          },
        },
        {
          name: 'describe_table',
          description: 'Get the schema of a table: columns, types, constraints, indexes, and foreign keys.',
          inputSchema: {
            type: 'object' as const,
            properties: {
              table_name: { type: 'string', description: 'Name of the table to describe' },
            },
            required: ['table_name'],
          },
        },
        {
          name: 'append_insight',
          description: 'Add a business insight to the insights memo resource. Useful for recording observations from analysis.',
          inputSchema: {
            type: 'object' as const,
            properties: {
              insight: { type: 'string', description: 'The business insight to record' },
            },
            required: ['insight'],
          },
        },
      ],
    }));
  • Validation helper used by the describe_table handler to ensure the table name is a valid SQL identifier.
    function validateTableName(name: string): void {
      if (!VALID_IDENTIFIER.test(name)) {
        throw new McpError(ErrorCode.InvalidParams, `Invalid table name: "${name}". Use only letters, numbers, and underscores.`);
      }
    }
Behavior3/5

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

No annotations are provided, so the description must cover behavioral traits. It indicates a read-only operation but does not discuss permissions, side effects, or rate limits, leaving gaps.

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, front-loaded sentence that conveys all necessary information without any unnecessary words.

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?

The description covers the key return components, but lacks details on format or ordering. Given no output schema, this is adequate but not fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The parameter 'table_name' is clearly described in the schema, and the tool description adds value by explaining what the retrieved schema includes, enhancing parameter understanding.

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 ('Get the schema of a table') and lists specific components (columns, types, constraints, indexes, foreign keys), distinguishing it from sibling tools like list_tables or read_query.

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 when to use (when schema information is needed) but provides no explicit guidance on when not to use or how it differs from alternatives like read_query.

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/isaacgounton/sqlite-mcp-server'

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