Skip to main content
Glama

get_project_events

Retrieve recent events and activities for a GitLab project using specified filters like date range, page number, and sorting order. Access project-specific updates efficiently via the MCP server.

Instructions

Get recent events/activities for a GitLab project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionNo
afterNo
beforeNo
pageNo
per_pageNo
project_idNo
sortNo
target_typeNo

Implementation Reference

  • MCP tool handler for 'get_project_events': parses input, validates pagination, calls GitLabApi.getProjectEvents, and formats response.
    case "get_project_events": {
      // Parse and validate the arguments
      const args = GetProjectEventsSchema.parse(request.params.arguments);
    
      // Additional validation for pagination parameters
      if (args.per_page && (args.per_page < 1 || args.per_page > 100)) {
        throw new Error("per_page must be between 1 and 100");
      }
    
      if (args.page && args.page < 1) {
        throw new Error("page must be greater than 0");
      }
    
      // Extract project_id and options
      const { project_id, ...options } = args;
    
      // Call the API function
      const events = await gitlabApi.getProjectEvents(project_id, options);
    
      // Format and return the response
      return formatEventsResponse(events);
    }
  • Core GitLab API method that fetches project events from the GitLab REST API, handles query params, and parses response.
    async getProjectEvents(
      projectId: string,
      options: {
        action?: string;
        target_type?: string;
        before?: string;
        after?: string;
        sort?: "asc" | "desc";
        page?: number;
        per_page?: number;
      } = {}
    ): Promise<GitLabEventsResponse> {
      const url = new URL(
        `${this.apiUrl}/projects/${encodeURIComponent(projectId)}/events`
      );
    
      // Add query parameters for filtering and pagination
      Object.entries(options).forEach(([key, value]) => {
        if (value !== undefined) {
          url.searchParams.append(key, value.toString());
        }
      });
    
      const response = await fetch(url.toString(), {
        headers: {
          Authorization: `Bearer ${this.token}`,
        },
      });
    
      if (!response.ok) {
        throw new McpError(
          ErrorCode.InternalError,
          `GitLab API error: ${response.statusText}`
        );
      }
    
      // Parse the response JSON
      const events = await response.json();
    
      // Get the total count from the headers
      const totalCount = parseInt(response.headers.get("X-Total") || "0");
    
      // Validate and return the response
      return GitLabEventsResponseSchema.parse({
        count: totalCount,
        items: events,
      });
    }
  • Zod schema defining input parameters for the get_project_events tool: project_id (required), optional filters and pagination.
    export const GetProjectEventsSchema = z.object({
      project_id: z.string(),
      action: z.string().optional(),
      target_type: z.string().optional(),
      before: z.string().optional(),
      after: z.string().optional(),
      sort: z.enum(['asc', 'desc']).optional(),
      page: z.number().optional(),
      per_page: z.number().optional()
    });
  • src/index.ts:168-172 (registration)
    Tool registration in ALL_TOOLS array: defines name, description, input schema, and read-only flag.
    {
      name: "get_project_events",
      description: "Get recent events/activities for a GitLab project",
      inputSchema: createJsonSchema(GetProjectEventsSchema),
      readOnly: true
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'recent events/activities' but fails to specify what constitutes 'recent' (e.g., time range defaults), whether results are paginated (implied by parameters but not stated), or authentication requirements. This leaves significant gaps in understanding the tool's behavior.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and appropriately sized for its content, making it easy to parse quickly.

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

Completeness2/5

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

Given the complexity of 8 parameters with no schema descriptions, no annotations, and no output schema, the description is inadequate. It does not explain return values, parameter usage, or behavioral traits, leaving the agent with insufficient information to use the tool effectively in context.

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

Parameters2/5

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

The input schema has 8 parameters with 0% description coverage, so the description must compensate. It only vaguely references 'recent events/activities' without explaining any parameters (e.g., 'action', 'target_type', pagination fields). This adds minimal semantic value, failing to address the schema's lack of documentation.

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

Purpose4/5

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

The description clearly states the verb ('Get') and resource ('recent events/activities for a GitLab project'), making the purpose understandable. However, it does not differentiate from sibling tools like 'list_commits' or 'list_issues', which also retrieve project-related data, leaving room for ambiguity in tool selection.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It lacks context about scenarios where this tool is preferred over other listing tools (e.g., 'list_issues' for issue-specific events) or prerequisites for usage, offering minimal assistance in decision-making.

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

Related 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/yoda-digital/mcp-gitlab-server'

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