get_activity
Retrieve recent activity feed showing user views, edits, and actions in Metabase to monitor user engagement and identify popular content trends.
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 handler function that implements the get_activity tool. It calls the Metabase API /api/activity endpoint, formats the recent activity events into a markdown list, and returns it as tool content. Handles 404 errors gracefully if the feature is unavailable.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 schema definition including name, description, and inputSchema for the limit parameter (integer, 1-100, default 20). This is part of the TOOL_DEFINITIONS array returned by list tools.{ 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)The switch case in executeTool method that registers and dispatches get_activity tool calls to the UserHandlers.getActivity method.case 'get_activity': return await this.userHandlers.getActivity(args.limit);