Skip to main content
Glama
MikelA92

Metabase MCP Server

by MikelA92

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
NameRequiredDescriptionDefault
limitNoMaximum 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,
          },
        },
      },
    },
  • 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);

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