Skip to main content
Glama
MikelA92

Metabase MCP Server

by MikelA92

get_database

Retrieve database details including engine type and connection information by ID to understand data sources for Metabase cards.

Instructions

🗄️ [SAFE] Get database information by ID including engine type and connection details. Use this to understand which database a card connects to. Risk: None - read-only operation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseIdYesThe ID of the database to retrieve

Implementation Reference

  • The main handler function that executes the get_database tool. It validates the databaseId, fetches database details from the Metabase API, and returns formatted text content with key database information.
      async getDatabase(databaseId) {
        Validators.validateDatabaseId(databaseId);
        
        this.logger.debug('Getting database', { databaseId });
        const database = await this.apiClient.makeRequest(`/api/database/${databaseId}`);
        
        return {
          content: [
            {
              type: 'text',
              text: `Database Information:
    ID: ${database.id}
    Name: ${database.name}
    Engine: ${database.engine}
    Description: ${database.description || 'No description'}
    Created: ${database.created_at}
    Updated: ${database.updated_at}`,
            },
          ],
        };
      }
  • The tool schema definition including name, description, and inputSchema for validating the databaseId parameter.
    {
      name: 'get_database',
      description: '🗄️ [SAFE] Get database information by ID including engine type and connection details. Use this to understand which database a card connects to. Risk: None - read-only operation.',
      inputSchema: {
        type: 'object',
        properties: {
          databaseId: {
            type: 'integer',
            description: 'The ID of the database to retrieve',
            minimum: 1,
          },
        },
        required: ['databaseId'],
      },
    },
  • The registration/dispatch point in the MCP server's executeTool switch statement that maps the tool name to the handler method.
    case 'get_database':
      return await this.databaseHandlers.getDatabase(args.databaseId);

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