Skip to main content
Glama
ZephyrDeng

mcp-server-gitlab

Gitlab Get User Tasks Tool

Retrieve and filter a user's pending tasks from GitLab using customizable criteria, such as task type or creation date, to streamline task management and improve workflow efficiency.

Instructions

获取当前用户的待办任务,支持多种过滤条件。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldsNo需要返回的字段路径数组,支持数组或逗号分隔字符串,用于过滤 API 响应字段。 示例: - ["id", "name", "owner.username"] - "id,name,owner.username" - undefined
taskFilterTypeNo任务过滤类型

Implementation Reference

  • Handler function that executes the tool logic: processes taskFilterType, constructs GitLab API params, fetches merge requests, filters fields if specified, and returns JSON stringified response or error.
    async execute(args: unknown, context: Context<Record<string, unknown> | undefined>) {
      const typedArgs = args as {
        taskFilterType?: string;
        fields?: string[];
      };
      
      try {
        const params: Record<string, any> = {};
    
        switch (typedArgs.taskFilterType) {
          case "ALL":
            break;
          case "ASSIGNED_MRS":
            params.include_assigned_mrs = true;
            break;
          case "REVIEW_MRS":
            params.include_review_mrs = true;
            break;
          case "MY_ISSUES":
            params.include_issues = true;
            break;
          case "MY_PIPELINES":
            params.include_pipelines = true;
            break;
          case "MR_CREATED_TODAY":
            params.type = "merge_request";
            params.created_after = new Date().toISOString().split("T")[0] + "T00:00:00Z";
            params.created_before = new Date().toISOString().split("T")[0] + "T23:59:59Z";
            break;
          case "ISSUES_CREATED_TODAY":
            params.type = "issue";
            params.created_after = new Date().toISOString().split("T")[0] + "T00:00:00Z";
            params.created_before = new Date().toISOString().split("T")[0] + "T23:59:59Z";
            break;
          case "CUSTOM":
            break;
          default:
            break;
        }
    
        const client = createGitlabClientFromContext(context);
        const response = await client.apiRequest("/merge_requests", "GET", params);
        if (typedArgs.fields) {
          const filteredResponse = filterResponseFields(response, typedArgs.fields);
          return {
            content: [{ type: "text", text: JSON.stringify(filteredResponse) }]
          } as ContentResult;
        }
        
        return {
          content: [{ type: "text", text: JSON.stringify(response) }]
        } as ContentResult;
      } catch (error: any) {
        return {
          content: [
            {
              type: "text",
              text: `GitLab MCP 工具调用异常:${error?.message || String(error)}`
            }
          ],
          isError: true
        };
      }
    }
  • Input schema using Zod: defines optional taskFilterType enum and fields array.
    parameters: z.object({
      taskFilterType: z.enum([
        "ALL",
        "ASSIGNED_MRS",
        "REVIEW_MRS",
        "MY_ISSUES",
        "MY_PIPELINES",
        "MR_CREATED_TODAY",
        "ISSUES_CREATED_TODAY",
        "CUSTOM",
      ]).optional().describe("任务过滤类型"),
      fields: createFieldsSchema(),
    }),
  • Primary registration function for FastMCP: includes GitlabGetUserTasksTool in fastmcpTools array and registers via server.addTool(tool) in the loop.
    export function registerGitLabToolsForFastMCP(server: FastMCP, options: GitLabToolsRegistryOptions = {}) {
      const { enableLogger = process.env.ENABLE_LOGGER === 'true' } = options;
    
      // Configure logger if enabled
      if (enableLogger) {
        gitlabApiClient.setLogger(console);
      }
    
      // Register tools based on filter options
      fastmcpTools.forEach(tool => {
        const standardizedName = toolNameMapping[tool.name as keyof typeof toolNameMapping];
        if (shouldRegisterTool(standardizedName as GitLabToolName, options.toolFilter)) {
          // GitLabTool is now fully compatible with FastMCP's base type, can be registered directly
          server.addTool(tool);
        }
      });
    }
  • fastmcpTools array that includes GitlabGetUserTasksTool for registration.
    const fastmcpTools = [
      GitlabAcceptMRTool,
      GitlabCreateMRCommentTool,
      GitlabCreateMRTool,
      GitlabGetUserTasksTool,
      GitlabRawApiTool,
      GitlabSearchProjectDetailsTool,
      GitlabSearchUserProjectsTool,
      GitlabUpdateMRTool,
    ];
  • toolNameMapping that maps GitlabGetUserTasksTool.name to standardized tool name.
    const toolNameMapping = {
      [GitlabSearchUserProjectsTool.name]: "Gitlab_Search_User_Projects_Tool",
      [GitlabGetUserTasksTool.name]: "Gitlab_Get_User_Tasks_Tool",
      [GitlabSearchProjectDetailsTool.name]: "Gitlab_Search_Project_Details_Tool",
      [GitlabCreateMRTool.name]: "Gitlab_Create_MR_Tool",
      [GitlabUpdateMRTool.name]: "Gitlab_Update_MR_Tool",
      [GitlabAcceptMRTool.name]: "Gitlab_Accept_MR_Tool",
      [GitlabCreateMRCommentTool.name]: "Gitlab_Create_MR_Comment_Tool",
      [GitlabRawApiTool.name]: "Gitlab_Raw_API_Tool",
    } as const;
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. While it mentions filtering capabilities, it fails to describe critical behavioral aspects such as whether this is a read-only operation (implied but not stated), authentication requirements, rate limits, pagination behavior, or error handling. For a tool with zero annotation coverage, this represents a significant gap in transparency.

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 extremely concise - a single sentence that efficiently communicates the core purpose and key capability. Every word earns its place with no wasted verbiage, and the information is front-loaded appropriately.

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?

For a tool with 2 parameters, no annotations, and no output schema, the description is insufficiently complete. While concise, it doesn't compensate for the lack of structured metadata by explaining what the tool returns, how results are formatted, or important behavioral constraints. The agent would need to guess about the output format and operational characteristics.

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?

The description mentions '支持多种过滤条件' (supports multiple filtering conditions), which aligns with the two parameters in the schema. However, with 100% schema description coverage (both parameters are well-documented in the schema), the description adds minimal value beyond what's already in the structured data. It doesn't provide additional context about parameter interactions or usage patterns.

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 action ('获取' - get/retrieve) and resource ('当前用户的待办任务' - current user's pending tasks), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from sibling tools like 'Gitlab Search Project Details Tool' or 'Gitlab Search User Projects Tool' that might also retrieve user-related data, which prevents a perfect score.

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 mentions '支持多种过滤条件' (supports multiple filtering conditions), which implies some context for usage, but provides no explicit guidance on when to use this tool versus alternatives like 'Gitlab Search User Projects Tool' or 'Gitlab Raw API Tool'. There are no when-to-use or when-not-to-use statements, leaving the agent to infer usage scenarios.

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

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