get_activity
Retrieve recent user activity feed from Metabase to monitor views, edits, and popular content through read-only access.
Instructions
📜 [SAFE] Get recent activity feed showing views, edits, and other actions in Metabase. Use this to see what users are doing or what content is popular. Risk: None - read-only operation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of activity items to return (default: 20) |
Implementation Reference
- The core handler function that implements the get_activity tool logic. It calls the Metabase /api/activity endpoint, formats the results into a readable text summary, and handles cases where the endpoint is unavailable (e.g., older Metabase versions).async getActivity(limit = 20) { Validators.validateLimit(limit, 1, 100); this.logger.debug('Getting activity', { limit }); try { const activity = await this.apiClient.makeRequest(`/api/activity?limit=${limit}`); return { content: [ { type: 'text', text: `Recent Activity (last ${limit} items): ${activity.map(a => `- ${a.timestamp} | ${a.user?.common_name || 'Unknown'} | ${a.topic} | ${a.details}` ).join('\n')}`, }, ], }; } catch (error) { if (error.message.includes('404')) { return { content: [{ type: 'text', text: 'Activity endpoint not available in this Metabase version' }], }; } throw error; } }
- The tool definition including name, description, and input schema for 'get_activity', which specifies an optional integer 'limit' parameter between 1 and 100.name: 'get_activity', description: '📜 [SAFE] Get recent activity feed showing views, edits, and other actions in Metabase. Use this to see what users are doing or what content is popular. Risk: None - read-only operation.', inputSchema: { type: 'object', properties: { limit: { type: 'integer', description: 'Maximum number of activity items to return (default: 20)', minimum: 1, maximum: 100, default: 20, }, }, }, },
- src/server/MetabaseMCPServer.js:222-223 (registration)Registration/dispatch in the MCP server's executeTool method switch statement, which maps the 'get_activity' tool call to the UserHandlers.getActivity handler.case 'get_activity': return await this.userHandlers.getActivity(args.limit);