Skip to main content
Glama

Gitlab Search Project Details Tool

Search for GitLab project details by project name and filter response fields to improve efficiency. Streamline project data retrieval for better team collaboration.

Instructions

根据项目名称搜索项目及其详细信息,支持字段过滤,提升响应效率。

Input Schema

NameRequiredDescriptionDefault
fieldsNo需要返回的字段路径数组,支持数组或逗号分隔字符串,用于过滤 API 响应字段。 示例: - ["id", "name", "owner.username"] - "id,name,owner.username" - undefined
projectNameYes项目名称

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "fields": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "string" } ], "description": "需要返回的字段路径数组,支持数组或逗号分隔字符串,用于过滤 API 响应字段。\n示例:\n- [\"id\", \"name\", \"owner.username\"]\n- \"id,name,owner.username\"\n- undefined" }, "projectName": { "description": "项目名称", "type": "string" } }, "required": [ "projectName" ], "type": "object" }

Implementation Reference

  • The execute function implementing the tool: parses args, creates GitLab client, searches projects by name, filters fields if specified, ensures array format, returns JSON content or error.
    async execute(args: unknown, context: Context<Record<string, unknown> | undefined>) { const typedArgs = args as { projectName: string; fields?: string[]; }; try { const client = createGitlabClientFromContext(context); const response = await client.apiRequest('/projects', 'GET', { search: typedArgs.projectName }); let result = response; if (typedArgs.fields) { result = filterResponseFields(response, typedArgs.fields); } if (!Array.isArray(result)) { result = [result]; } return { content: [{ type: "text", text: JSON.stringify(result) }] } as ContentResult; } catch (error: any) { return { content: [ { type: "text", text: `GitLab MCP 工具调用异常:${error?.message || String(error)}` } ], isError: true }; } }
  • Zod schema for tool input parameters: required projectName (string) and optional fields for response filtering.
    parameters: z.object({ projectName: z.string().describe("项目名称"), fields: createFieldsSchema(), }),
  • Array of FastMCP tools including GitlabSearchProjectDetailsTool, iterated for conditional registration in registerGitLabToolsForFastMCP.
    const fastmcpTools = [ GitlabAcceptMRTool, GitlabCreateMRCommentTool, GitlabCreateMRTool, GitlabGetUserTasksTool, GitlabRawApiTool, GitlabSearchProjectDetailsTool, GitlabSearchUserProjectsTool, GitlabUpdateMRTool, ];
  • Mapping from tool instance name to standardized GitLabToolName for filtering and identification.
    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;
  • Import of the tool for inclusion in registry.
    import { GitlabSearchProjectDetailsTool } from "./tools/GitlabSearchProjectDetailsTool";

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