Skip to main content
Glama
ttpears

GitLab MCP Server

by ttpears

Project Events

list_project_events
Read-onlyIdempotent

Retrieve activity events for a GitLab project, such as commits, merge requests, and issue updates. Filter by action type, target, or date range to get specific event history.

Instructions

List activity events for a single GitLab project — commits pushed, MRs opened/merged, issues touched, notes added. Accepts project full path or numeric ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectYesProject full path (e.g. "group/my-project") or numeric project ID
actionNoFilter by action type
target_typeNoFilter by target resource type
beforeNoOnly events before this date (YYYY-MM-DD)
afterNoOnly events after this date (YYYY-MM-DD)
sortNoSort order (default desc — newest first)desc
pageNoPage number (1-based)
per_pageNoResults per page
userCredentialsNoYour GitLab credentials (optional — falls back to the configured env token if not provided)

Implementation Reference

  • MCP tool definition for 'list_project_events' — defines name, description, input schema (project path/ID + events common fields), and handler that calls GitLabGraphQLClient.listProjectEvents() via REST API
    const listProjectEventsTool: Tool = {
      name: 'list_project_events',
      title: 'Project Events',
      description:
        'List activity events for a single GitLab project — commits pushed, MRs opened/merged, issues touched, notes added. Accepts project full path or numeric ID.',
      requiresAuth: false,
      requiresWrite: false,
      annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
      inputSchema: withUserAuth(z.object({
        project: z
          .string()
          .min(1)
          .describe('Project full path (e.g. "group/my-project") or numeric project ID'),
        ...EventCommonFields,
      })),
      handler: async (input, client, userConfig) => {
        const credentials = input.userCredentials ? validateUserConfig(input.userCredentials) : userConfig;
        const { userCredentials, project, ...params } = input;
        return client.listProjectEvents(project.trim(), params, credentials);
      },
    };
  • Common input schema fields shared by list_project_events (and other event tools) — action filter, target_type filter, date range, sort, pagination
    const EventCommonFields = {
      action: EventActionEnum,
      target_type: EventTargetTypeEnum,
      before: z.string().optional().describe('Only events before this date (YYYY-MM-DD)'),
      after: z.string().optional().describe('Only events after this date (YYYY-MM-DD)'),
      sort: z.enum(['asc', 'desc']).default('desc').describe('Sort order (default desc — newest first)'),
      page: z.number().int().min(1).default(1).describe('Page number (1-based)'),
      per_page: z.number().int().min(1).max(100).default(20).describe('Results per page'),
    };
  • src/tools.ts:2272-2300 (registration)
    listProjectEventsTool is exported in the readOnlyTools array, which is included in the exported tools array — the registration that makes it available to the MCP server
    export const readOnlyTools: Tool[] = [
      getProjectTool,
      getIssuesTool,
      getMergeRequestsTool,
      executeCustomQueryTool,
      getAvailableQueriesTools,
      getMergeRequestPipelinesTool,
      getPipelineJobsTool,
      getMergeRequestDiffsTool,
      getMergeRequestCommitsTool,
      getNotesTool,
      getIssueContextTool,
      getMergeRequestContextTool,
      listMilestonesTool,
      listIterationsTool,
      getTimeTrackingTool,
      getMergeRequestReviewersTool,
      getProjectStatisticsTool,
      listBroadcastMessagesTool,
      getBroadcastMessageTool,
      getWorkItemTool,
      listWorkItemsTool,
      listUserEventsTool,
      listProjectEventsTool,
      listMyEventsTool,
      analyticsUserSummaryTool,
      analyticsGroupSummaryTool,
      analyticsReviewBottlenecksTool,
    ];
  • src/index.ts:103-146 (registration)
    MCP server CallTool handler that matches tool name 'list_project_events' to listProjectEventsTool and invokes its handler
    server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
      const { name, arguments: args } = request.params;
    
      const tool = tools.find(t => t.name === name);
      if (!tool) {
        throw new McpError(ErrorCode.MethodNotFound, `Tool ${name} not found`);
      }
    
      try {
        const validatedInput = tool.inputSchema.parse(args || {});
    
        // Extract user credentials: prioritize args, fallback to session-specific config
        let userConfig = validatedInput.userCredentials;
    
        // If no credentials in args, try to get from session context.
        // The MCP SDK exposes the transport session id at extra.sessionId
        // (top-level), not under extra._meta — see RequestHandlerExtra in
        // @modelcontextprotocol/sdk/shared/protocol.d.ts.
        if (!userConfig && extra?.sessionId) {
          const sessionData = this.httpSessions.get(extra.sessionId as string);
          if (sessionData?.userConfig) {
            userConfig = sessionData.userConfig;
          }
        }
    
        delete validatedInput.userCredentials; // Remove from input to avoid passing to handler
    
        const result = await tool.handler(validatedInput, this.gitlabClient, userConfig);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error) {
        if (error instanceof Error) {
          throw new McpError(ErrorCode.InternalError, error.message);
        }
        throw new McpError(ErrorCode.InternalError, 'Unknown error occurred');
      }
    });
  • GitLabGraphQLClient.listProjectEvents() — makes a REST API call to GET /projects/:id/events with filtering/pagination params
    async listProjectEvents(
      projectIdOrPath: string | number,
      params: {
        action?: string;
        target_type?: string;
        before?: string;
        after?: string;
        sort?: 'asc' | 'desc';
        page?: number;
        per_page?: number;
      },
      userConfig?: UserConfig
    ): Promise<any> {
      return this.restRequest('GET', `/projects/${encodeURIComponent(String(projectIdOrPath))}/events`, {
        query: {
          action: params.action,
          target_type: params.target_type,
          before: params.before,
          after: params.after,
          sort: params.sort,
          page: params.page ?? 1,
          per_page: Math.min(params.per_page ?? 20, this.config.maxPageSize),
        },
        userConfig,
      });
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already provide readOnlyHint, destructiveHint, and idempotentHint. The description adds value by listing event categories (commits, MRs, issues, notes) and clarifying the project parameter format. However, it does not mention pagination or sorting behavior beyond the schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two concise sentences that front-load the purpose and key parameter detail. No redundant information; every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of 9 parameters and no output schema, the description is brief but adequate because the schema covers all parameters with descriptions. However, it omits practical guidance on pagination and sorting, which are important for a list endpoint.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The description adds marginal value by explaining the 'project' parameter accepts full path or ID, but the schema already defines it. No significant additional meaning for other parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the purpose: 'List activity events for a single GitLab project', specifying the verb and resource. It distinguishes from siblings like list_my_events and list_user_events by explicitly scoping to a single project.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for a single project but does not explicitly mention when not to use this tool or compare it to siblings like list_my_events or get_issues. No alternatives or exclusions are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/ttpears/gitlab-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server