Skip to main content
Glama
MikelA92

Metabase MCP Server

by MikelA92

get_database_metadata

Retrieve complete database schema including all tables, columns, and field types to understand data structure and relationships for analysis.

Instructions

🔍 [SAFE] Get complete metadata for a database including ALL tables, columns, and field types. This is comprehensive and may return large amounts of data. Use this when you need to understand the full database schema. Risk: None - read-only, but returns large payloads.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseIdYesThe ID of the database

Implementation Reference

  • The primary handler function that executes the get_database_metadata tool. Fetches comprehensive metadata from the Metabase API endpoint `/api/database/${databaseId}/metadata`, processes tables with field counts, and returns a formatted text response suitable for MCP.
      async getDatabaseMetadata(databaseId) {
        Validators.validateDatabaseId(databaseId);
        
        this.logger.debug('Getting database metadata', { databaseId });
        const metadata = await this.apiClient.makeRequest(`/api/database/${databaseId}/metadata`);
        
        const tables = metadata.tables?.map(t => ({
          id: t.id,
          name: t.name,
          schema: t.schema,
          fieldCount: t.fields?.length || 0,
        })) || [];
    
        return {
          content: [
            {
              type: 'text',
              text: `Database Metadata (ID: ${databaseId}):
    Database: ${metadata.name}
    Engine: ${metadata.engine}
    Total Tables: ${tables.length}
    
    Tables:
    ${tables.map(t => 
      `- ID: ${t.id} | Schema: ${t.schema} | Name: ${t.name} | Fields: ${t.fieldCount}`
    ).join('\n')}`,
            },
          ],
        };
      }
  • Defines the input schema, description, and name for the get_database_metadata tool, used by the MCP server for tool listing and validation.
    {
      name: 'get_database_metadata',
      description: '🔍 [SAFE] Get complete metadata for a database including ALL tables, columns, and field types. This is comprehensive and may return large amounts of data. Use this when you need to understand the full database schema. Risk: None - read-only, but returns large payloads.',
      inputSchema: {
        type: 'object',
        properties: {
          databaseId: {
            type: 'integer',
            description: 'The ID of the database',
            minimum: 1,
          },
        },
        required: ['databaseId'],
      },
    },
  • Registers and dispatches the get_database_metadata tool call to the appropriate handler method in the main executeTool switch statement.
    case 'get_database_metadata':
      return await this.databaseHandlers.getDatabaseMetadata(args.databaseId);
Behavior5/5

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

With no annotations provided, the description carries full burden and delivers excellent behavioral disclosure. It explicitly states '[SAFE]' and 'Risk: None - read-only', clarifies it 'may return large amounts of data' and 'returns large payloads', and warns about comprehensiveness - all crucial behavioral traits not in the schema.

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?

Perfectly front-loaded with the core purpose in the first sentence, followed by usage guidance and risk information. Every sentence earns its place with zero wasted words, making it highly efficient while remaining comprehensive.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only tool with 100% schema coverage but no annotations or output schema, the description provides complete context. It covers safety, behavioral characteristics (large payloads), usage guidance, and distinguishes from siblings - everything an agent needs to select and invoke this tool correctly.

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 the single 'databaseId' parameter. The description doesn't add any parameter-specific information beyond what's in the schema, maintaining the baseline score of 3 when 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 verb 'Get' and resource 'complete metadata for a database', specifying it includes 'ALL tables, columns, and field types'. It distinguishes from siblings like 'get_table_metadata' by emphasizing comprehensiveness and full database schema understanding.

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

Usage Guidelines5/5

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

Explicitly states 'Use this when you need to understand the full database schema', providing clear when-to-use guidance. It contrasts with siblings by specifying this tool returns comprehensive metadata rather than partial or specific components.

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/MikelA92/metabase-mcp-mab'

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