Skip to main content
Glama
MikelA92

Metabase MCP Server

by MikelA92

get_collection_items

Retrieve all cards, dashboards, and models from a specific Metabase collection to view organized content. Use collection ID or 'root' for root folder.

Instructions

📁 [SAFE] Get all items (cards, dashboards, models) in a specific collection. Use this to see what content is organized in a folder. Risk: None - read-only operation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionIdYesThe ID of the collection (use "root" for root collection)
modelsNoFilter by item type (optional)

Implementation Reference

  • Core handler function that executes the get_collection_items tool logic: validates input, calls Metabase API to fetch items, formats and returns the response in MCP content format.
      async getCollectionItems(collectionId, models = null) {
        Validators.validateCollectionId(collectionId);
        
        this.logger.debug('Getting collection items', { collectionId, models });
        
        const params = models && models.length > 0 ? new URLSearchParams({ models: models.join(',') }) : '';
        const items = await this.apiClient.makeRequest(`/api/collection/${collectionId}/items${params ? '?' + params : ''}`);
        
        return {
          content: [
            {
              type: 'text',
              text: `Items in Collection ${collectionId}:
    Found ${items.data?.length || 0} items
    
    ${(items.data || []).map(item => 
      `- [${item.model}] ID: ${item.id} | Name: ${item.name}`
    ).join('\n')}`,
            },
          ],
        };
      }
  • Tool schema definition: specifies name, description, input schema with collectionId (required) and optional models filter.
    {
      name: 'get_collection_items',
      description: '📁 [SAFE] Get all items (cards, dashboards, models) in a specific collection. Use this to see what content is organized in a folder. Risk: None - read-only operation.',
      inputSchema: {
        type: 'object',
        properties: {
          collectionId: {
            type: 'string',
            description: 'The ID of the collection (use "root" for root collection)',
          },
          models: {
            type: 'array',
            description: 'Filter by item type (optional)',
            items: {
              type: 'string',
              enum: ['card', 'dashboard', 'dataset'],
            },
          },
        },
        required: ['collectionId'],
      },
    },
  • Tool registration in the main server switch statement: dispatches get_collection_items calls to the collectionHandlers instance.
    case 'get_collection_items':
      return await this.collectionHandlers.getCollectionItems(args.collectionId, args.models);
  • Shared API client method getCollectionItems used by the handler to make the actual Metabase API request and parse response.
    async getCollectionItems(collectionId, models = null) {
      Validators.validateCollectionId(collectionId);
    
      const params = models && models.length > 0 ? new URLSearchParams({ models: models.join(',') }) : '';
      const items = await this.makeRequest(`/api/collection/${collectionId}/items${params ? '?' + params : ''}`);
      
      return {
        data: items.data?.map(item => ({
          id: item.id,
          name: item.name,
          description: item.description,
          model: item.model,
        })) || [],
        total: items.total || 0,
      };
    }
Behavior4/5

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

With no annotations provided, the description carries the full burden and adds valuable behavioral context: it explicitly states 'Risk: None - read-only operation' and includes a safety emoji '[SAFE]', which informs the agent about the operation's nature and safety. However, it lacks details on rate limits, pagination, or response format.

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 appropriately sized and front-loaded: it starts with the core purpose, includes usage guidance and risk information in a single, efficient sentence. Every part adds value without waste, making it easy for an agent to parse quickly.

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?

Given the tool's low complexity (read-only, 2 parameters), no annotations, and no output schema, the description is mostly complete: it covers purpose, usage, and safety. However, it lacks details on output format or error handling, which could be helpful for an agent invoking the tool.

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 both parameters thoroughly. The description adds no additional parameter semantics beyond what the schema provides, such as explaining the 'models' filter usage or 'collectionId' nuances. Baseline 3 is appropriate as the 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 'all items (cards, dashboards, models) in a specific collection', specifying the scope. It distinguishes from siblings like list_cards, list_dashboards, etc., by focusing on collection-specific content rather than general listings.

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

Usage Guidelines4/5

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

The description provides clear context: 'Use this to see what content is organized in a folder.' It implies when to use this tool (for collection-based exploration) but does not explicitly state when not to use it or name alternatives among siblings, such as list_cards for broader listings.

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