Skip to main content
Glama
turbot
by turbot

steampipe_table_show

Retrieve table structure details including column definitions, data types, and descriptions from Steampipe databases to understand data organization.

Instructions

Get detailed information about a specific Steampipe table, including column definitions, data types, and descriptions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe name of the table to show details for. Can be schema qualified (e.g. 'aws_account' or 'aws.aws_account').
schemaNoOptional schema name. If provided, only searches in this schema. If not provided, searches across all schemas.

Implementation Reference

  • The core handler function that performs SQL queries on information_schema to retrieve and format detailed table information including columns, data types, nullability, defaults, and descriptions.
    handler: async (db: DatabaseService, args: { name: string; schema?: string }) => {
      if (!db) {
        return {
          content: [{
            type: "text",
            text: "Database not available. Please ensure Steampipe is running and try again."
          }],
          isError: true
        };
      }
    
      try {
        // Check if schema exists if specified
        if (args.schema) {
          const schemaQuery = `
            SELECT schema_name 
            FROM information_schema.schemata 
            WHERE schema_name = $1
          `;
          const schemaResult = await db.executeQuery(schemaQuery, [args.schema]);
          if (schemaResult.length === 0) {
            return {
              content: [{
                type: "text",
                text: `Schema '${args.schema}' not found`
              }],
              isError: true
            };
          }
        }
    
        // Build the query based on provided arguments
        let query = `
          SELECT 
            t.table_schema as schema,
            t.table_name as name,
            t.table_type as type,
            c.column_name,
            c.data_type,
            c.is_nullable,
            c.column_default,
            c.character_maximum_length,
            c.numeric_precision,
            c.numeric_scale,
            col_description(format('%I.%I', t.table_schema, t.table_name)::regclass::oid, c.ordinal_position) as description
          FROM information_schema.tables t
          LEFT JOIN information_schema.columns c 
            ON c.table_schema = t.table_schema 
            AND c.table_name = t.table_name
          WHERE t.table_schema NOT IN ('information_schema', 'pg_catalog')
        `;
    
        const params: any[] = [];
        let paramIndex = 1;
    
        if (args.schema) {
          query += ` AND t.table_schema = $${paramIndex}`;
          params.push(args.schema);
          paramIndex++;
        }
    
        query += ` AND t.table_name = $${paramIndex}`;
        params.push(args.name);
    
        query += " ORDER BY c.ordinal_position";
    
        const result = await db.executeQuery(query, params);
        if (result.length === 0) {
          return {
            content: [{
              type: "text",
              text: `Table '${args.name}' not found${args.schema ? ` in schema '${args.schema}'` : ''}`
            }],
            isError: true
          };
        }
    
        // Format the result into table and columns structure
        const table = {
          schema: result[0].schema,
          name: result[0].name,
          type: result[0].type,
          columns: result.map(row => ({
            name: row.column_name,
            type: row.data_type,
            nullable: row.is_nullable === 'YES',
            default: row.column_default,
            ...(row.character_maximum_length && { character_maximum_length: row.character_maximum_length }),
            ...(row.numeric_precision && { numeric_precision: row.numeric_precision }),
            ...(row.numeric_scale && { numeric_scale: row.numeric_scale }),
            ...(row.description && { description: row.description })
          }))
        };
    
        return {
          content: [{
            type: "text",
            text: JSON.stringify({ table })
          }]
        };
      } catch (err) {
        logger.error("Error showing table details:", err);
        return {
          content: [{
            type: "text",
            text: `Failed to get table details: ${err instanceof Error ? err.message : String(err)}`
          }],
          isError: true
        };
      }
    }
  • JSON Schema for tool input parameters: required 'name' (table name) and optional 'schema'.
    inputSchema: {
      type: "object",
      additionalProperties: false,
      required: ["name"],
      properties: {
        name: {
          type: "string",
          description: "The name of the table to show details for. Can be schema qualified (e.g. 'aws_account' or 'aws.aws_account')."
        },
        schema: {
          type: "string",
          description: "Optional schema name. If provided, only searches in this schema. If not provided, searches across all schemas."
        }
      }
    },
  • The tools registry object that includes 'steampipe_table_show' mapped to the imported tool implementation, used by the MCP server handlers.
    export const tools = {
      steampipe_query: queryTool as DbTool,
      steampipe_table_list: tableListTool as DbTool,
      steampipe_table_show: tableShowTool as DbTool,
      steampipe_plugin_list: pluginListTool as DbTool,
      steampipe_plugin_show: pluginShowTool as DbTool,
    } as const;
  • Import of the steampipe_table_show tool implementation.
    import { tool as tableShowTool } from './steampipe_table_show.js';
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 describes the tool's function but lacks details on behavioral traits such as error handling (e.g., what happens if the table doesn't exist), performance characteristics, or output format. This is a significant gap for a tool with no annotation coverage.

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 the tool's purpose and scope without unnecessary words. It's front-loaded with the main action and resource, making it easy to understand at a glance.

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 (2 parameters, no output schema, no annotations), the description is minimally adequate. It covers the purpose but lacks behavioral context and output details, which are important for a tool that retrieves metadata. Without annotations or output schema, more completeness would be beneficial.

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 fully documents both parameters ('name' and 'schema') with clear descriptions. The description doesn't add any parameter-specific information beyond what's in the schema, such as examples or constraints. 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.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get detailed information') and resource ('specific Steampipe table'), and specifies the scope of information returned ('including column definitions, data types, and descriptions'). It distinguishes from the sibling 'steampipe_table_list' by focusing on details for a single table rather than listing tables. However, it doesn't explicitly contrast with 'steampipe_query' which might also return table information through queries.

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 detailed metadata about a specific table is needed, but doesn't provide explicit guidance on when to use this tool versus alternatives like 'steampipe_table_list' for listing tables or 'steampipe_query' for querying data. It mentions the resource type ('Steampipe table') but lacks context on prerequisites or exclusions.

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/turbot/steampipe-mcp'

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