list_segments
Retrieve all saved filter segments from Metabase to reuse predefined filters like Active Users or Premium Customers across your analytics queries.
Instructions
🎯 [SAFE] List all segments (saved filters) in Metabase. Segments are reusable filters like "Active Users" or "Premium Customers". Risk: None - read-only operation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The core handler function that fetches segments from Metabase API endpoint '/api/segment' and formats them into a readable text list.async listSegments() { this.logger.debug('Listing segments'); const segments = await this.apiClient.makeRequest('/api/segment'); return { content: [ { type: 'text', text: `Segments: ${segments.map(s => `- ID: ${s.id} | Name: ${s.name} | Table: ${s.table?.name}${s.description ? ` | ${s.description}` : ''}` ).join('\n')}`, }, ], }; }
- JSON schema definition for the 'list_segments' tool, specifying no input parameters are required.name: 'list_segments', description: '🎯 [SAFE] List all segments (saved filters) in Metabase. Segments are reusable filters like "Active Users" or "Premium Customers". Risk: None - read-only operation.', inputSchema: { type: 'object', properties: {}, }, },
- src/server/MetabaseMCPServer.js:216-217 (registration)Registration of the 'list_segments' tool in the main server's executeTool switch statement, delegating to the handler instance.case 'list_segments': return await this.segmentMetricHandlers.listSegments();