Skip to main content
Glama
MikelA92
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, }; }

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