Skip to main content
Glama
ZephyrDeng

mcp-server-gitlab

Gitlab Raw API Tool

Easily call any GitLab REST API, customize requests, and filter response fields for debugging or advanced workflows. Streamline integration with GitLab for efficient project and task management.

Instructions

支持自定义调用任意 GitLab REST API,适合调试和高级用法。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNo请求体
endpointYesGitLab API 路径,如 /projects
fieldsNo需要返回的字段路径数组,支持数组或逗号分隔字符串,用于过滤 API 响应字段。 示例: - ["id", "name", "owner.username"] - "id,name,owner.username" - undefined
methodYesHTTP 方法
paramsNo查询参数

Implementation Reference

  • The execute function implementing the core logic of the Gitlab Raw API Tool: validates args, creates GitLab client, performs API request, optionally filters response fields, and returns JSON or error.
    async execute(args: unknown, context: Context<Record<string, unknown> | undefined>) {
      const typedArgs = args as {
        endpoint: string;
        method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
        params?: Record<string, any>;
        data?: Record<string, any>;
        fields?: string[];
      };
    
      try {
        const client = createGitlabClientFromContext(context);
        const response = await client.apiRequest(
          typedArgs.endpoint,
          typedArgs.method,
          typedArgs.params,
          typedArgs.data
        );
    
        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
        };
      }
    }
  • Zod schema defining the input parameters for the tool: endpoint (API path), method (HTTP method), optional params, data, and fields for response filtering.
    parameters: z.object({
      endpoint: z.string().describe("GitLab API 路径,如 /projects"),
      method: z.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).describe("HTTP 方法"),
      params: z.record(z.any()).optional().describe("查询参数"),
      data: z.record(z.any()).optional().describe("请求体"),
      fields: createFieldsSchema(),
    }),
  • Array defining all GitLab tools for FastMCP registration, including GitlabRawApiTool.
    const fastmcpTools = [
      GitlabAcceptMRTool,
      GitlabCreateMRCommentTool,
      GitlabCreateMRTool,
      GitlabGetUserTasksTool,
      GitlabRawApiTool,
      GitlabSearchProjectDetailsTool,
      GitlabSearchUserProjectsTool,
      GitlabUpdateMRTool,
    ];
  • Core registration loop in registerGitLabToolsForFastMCP that adds GitlabRawApiTool (and others) to the FastMCP server using server.addTool(tool).
    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);
      }
  • Name mapping for GitlabRawApiTool to its standardized registered name 'Gitlab_Raw_API_Tool' used in filtering and typing.
    [GitlabRawApiTool.name]: "Gitlab_Raw_API_Tool",
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It only mentions the tool is for '调试和高级用法' (debugging and advanced usage), which hints at flexibility but doesn't disclose critical behavioral traits like authentication requirements, rate limits, error handling, or what happens with destructive operations (DELETE/PUT/PATCH methods). For a generic API tool with 5 parameters including destructive HTTP methods, this is a significant gap.

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 with just one sentence in Chinese: '支持自定义调用任意 GitLab REST API,适合调试和高级用法。' (Supports custom calls to any GitLab REST API, suitable for debugging and advanced usage). Every word earns its place - it states the core capability and primary use cases without any fluff or repetition.

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 this is a complex, generic API tool with 5 parameters (including destructive HTTP methods), no annotations, and no output schema, the description is insufficiently complete. It doesn't address authentication, error responses, rate limits, or provide guidance on constructing valid API calls. For a tool that essentially provides raw HTTP access to GitLab's API, users need more context about safe usage patterns and limitations.

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 adds no parameter-specific information beyond what's already in the schema (which has 100% coverage). It doesn't explain how parameters interact, provide examples beyond what's in schema descriptions, or clarify edge cases. With high schema coverage, the baseline is 3, but the description doesn't compensate with additional semantic context about parameter 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 tool's purpose: '支持自定义调用任意 GitLab REST API' (supports custom calls to any GitLab REST API). It specifies the verb ('调用' - call/invoke) and resource ('GitLab REST API'), making it clear this is a generic API caller. However, it doesn't explicitly distinguish itself from sibling tools like 'Gitlab Search Project Details Tool' or 'Gitlab Update MR Tool' which are specific API endpoints.

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

Usage Guidelines4/5

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

The description provides clear context about when to use this tool: '适合调试和高级用法' (suitable for debugging and advanced usage). This implies it should be used when specific sibling tools don't cover needed functionality or for custom API exploration. However, it doesn't explicitly state when NOT to use it or name specific alternatives among the sibling tools.

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