gitlab_get_merge_request_changes
Retrieve the changes (diff) of a specific merge request in GitLab by providing the merge request internal ID and project ID or path. Facilitates code review and updates tracking.
Instructions
Get changes (diff) of a specific merge request
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| merge_request_iid | Yes | The internal ID of the merge request | |
| project_id | Yes | The ID or URL-encoded path of the project |
Input Schema (JSON Schema)
{
"properties": {
"merge_request_iid": {
"description": "The internal ID of the merge request",
"type": "number"
},
"project_id": {
"description": "The ID or URL-encoded path of the project",
"type": "string"
}
},
"required": [
"project_id",
"merge_request_iid"
],
"type": "object"
}
Implementation Reference
- The main handler function that implements the tool logic by fetching merge request changes from the GitLab API endpoint `/projects/{project_id}/merge_requests/{merge_request_iid}/changes` and formatting the response.export const getMergeRequestChanges: ToolHandler = async (params, context) => { const { project_id, merge_request_iid } = params.arguments || {}; if (!project_id || !merge_request_iid) { throw new McpError(ErrorCode.InvalidParams, 'project_id and merge_request_iid are required'); } const response = await context.axiosInstance.get( `/projects/${encodeURIComponent(String(project_id))}/merge_requests/${merge_request_iid}/changes` ); return formatResponse(response.data); };
- src/utils/tools-data.ts:106-123 (schema)Defines the tool metadata including name, description, and input schema requiring project_id and merge_request_iid.{ name: 'gitlab_get_merge_request_changes', description: 'Get changes (diff) of a specific merge request', inputSchema: { type: 'object', properties: { project_id: { type: 'string', description: 'The ID or URL-encoded path of the project' }, merge_request_iid: { type: 'number', description: 'The internal ID of the merge request' } }, required: ['project_id', 'merge_request_iid'] } },
- src/utils/tool-registry.ts:29-29 (registration)Registers the tool name to its handler function from repoHandlers.gitlab_get_merge_request_changes: repoHandlers.getMergeRequestChanges,