@zereight/mcp-gitlab 2.1.61 → 2.1.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,18 @@
1
1
  import { after, before, describe, test } from "node:test";
2
2
  import assert from "node:assert";
3
3
  import { Buffer } from "node:buffer";
4
+ import fs from "node:fs";
5
+ import path, { dirname } from "node:path";
6
+ import { fileURLToPath } from "node:url";
4
7
  import { cleanupServers, findAvailablePort, HOST, launchServer, TransportMode, } from "./utils/server-launcher.js";
5
8
  import { findMockServerPort, MockGitLabServer } from "./utils/mock-gitlab-server.js";
6
9
  import { CustomHeaderClient } from "./clients/custom-header-client.js";
7
10
  const MOCK_TOKEN = "mock-concurrent-token-12345";
8
11
  const TEST_PROJECT_ID = "123";
12
+ const __filename = fileURLToPath(import.meta.url);
13
+ const __dirname = dirname(__filename);
14
+ const packageJsonPath = path.resolve(__dirname, "../package.json");
15
+ const PACKAGE_VERSION = JSON.parse(fs.readFileSync(packageJsonPath, "utf8")).version;
9
16
  function fileResponse(filePath, content) {
10
17
  return {
11
18
  file_name: filePath.split("/").at(-1),
@@ -129,6 +136,14 @@ describe("Streamable HTTP health check capacity logging", { timeout: 20_000 }, (
129
136
  if (mockGitLab)
130
137
  await mockGitLab.stop();
131
138
  });
139
+ test("reports server version when healthy", async () => {
140
+ const response = await fetch(`${baseUrl}/health`);
141
+ const body = (await response.json());
142
+ assert.strictEqual(response.status, 200);
143
+ assert.strictEqual(body.status, "healthy");
144
+ assert.strictEqual(body.version, PACKAGE_VERSION);
145
+ assert.strictEqual(body.activeSessions, 0);
146
+ });
132
147
  test("logs active session capacity when health check is degraded", async () => {
133
148
  const client = new CustomHeaderClient({ Authorization: `Bearer ${MOCK_TOKEN}` });
134
149
  await client.connect(mcpUrl);
@@ -137,6 +152,7 @@ describe("Streamable HTTP health check capacity logging", { timeout: 20_000 }, (
137
152
  const body = (await response.json());
138
153
  assert.strictEqual(response.status, 503);
139
154
  assert.strictEqual(body.status, "degraded");
155
+ assert.strictEqual(body.version, PACKAGE_VERSION);
140
156
  assert.strictEqual(body.activeSessions, 1);
141
157
  assert.strictEqual(body.maxSessions, 1);
142
158
  // ponytail: poll stdout; fixed 100ms sleep flakes under CI jitter
@@ -1,8 +1,15 @@
1
1
  import { describe, test } from "node:test";
2
2
  import assert from "node:assert";
3
3
  import { spawn } from "child_process";
4
+ import fs from "node:fs";
5
+ import path, { dirname } from "node:path";
6
+ import { fileURLToPath } from "node:url";
4
7
  import { MockGitLabServer, findMockServerPort } from "./utils/mock-gitlab-server.js";
5
8
  const MOCK_TOKEN = "glpat-mock-token-12345";
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = dirname(__filename);
11
+ const packageJsonPath = path.resolve(__dirname, "../package.json");
12
+ const PACKAGE_VERSION = JSON.parse(fs.readFileSync(packageJsonPath, "utf8")).version;
6
13
  function createMockGitLabServer(port) {
7
14
  return new MockGitLabServer({
8
15
  port,
@@ -73,6 +80,7 @@ describe("When health_check runs", () => {
73
80
  const result = await callHealthCheckAsync(baseEnv(mockGitLab.getUrl()));
74
81
  assert.equal(result.status, "ok");
75
82
  assert.equal(result.authenticated, true);
83
+ assert.equal(result.mcp_server_version, PACKAGE_VERSION);
76
84
  assert.equal(result.version, "18.3.1-ee");
77
85
  assert.equal(result.revision, "abc1234");
78
86
  assert.equal(result.enterprise, true);
@@ -94,6 +102,7 @@ describe("When health_check runs", () => {
94
102
  const result = await callHealthCheckAsync(baseEnv(mockGitLab.getUrl()));
95
103
  assert.equal(result.status, "ok");
96
104
  assert.equal(result.authenticated, true);
105
+ assert.equal(result.mcp_server_version, PACKAGE_VERSION);
97
106
  assert.equal("version" in result, false);
98
107
  assert.equal("revision" in result, false);
99
108
  assert.equal("enterprise" in result, false);
@@ -16,7 +16,7 @@ const MOCK_PORT_BASE = 9200;
16
16
  const MCP_PORT_BASE = 3200;
17
17
  // Known tool counts per toolset (from TOOLSET_DEFINITIONS)
18
18
  const TOOLSET_TOOL_COUNTS = {
19
- merge_requests: 42,
19
+ merge_requests: 43,
20
20
  issues: 24,
21
21
  repositories: 7,
22
22
  branches: 15,
@@ -101,7 +101,7 @@ describe("update_project", () => {
101
101
  await assert.rejects(() => callUpdateProject({ project_id: TEST_PROJECT_ID, issues_access_level: "public" }, {
102
102
  GITLAB_API_URL: "https://gitlab.example.com/api/v4",
103
103
  GITLAB_PERSONAL_ACCESS_TOKEN: MOCK_TOKEN,
104
- }), /Invalid enum value/);
104
+ }), /(Invalid enum value|Invalid option)/);
105
105
  });
106
106
  test("rejects empty updates before calling GitLab", async () => {
107
107
  await assert.rejects(() => callUpdateProject({ project_id: TEST_PROJECT_ID }, {
@@ -0,0 +1,384 @@
1
+ import assert from "node:assert/strict";
2
+ import fs from "node:fs";
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+ import { describe, test } from "node:test";
6
+ import { createMaskingEngine, createMaskingPolicyResolver } from "../../masking/engine.js";
7
+ import { getManagedMaskingProjectIds } from "../../masking/project-scope.js";
8
+ import { allTools } from "../../tools/registry.js";
9
+ describe("response masking", () => {
10
+ test("is a no-op and does not read a config when disabled", () => {
11
+ const workspace = fs.mkdtempSync(path.join(os.tmpdir(), "gitlab-mask-"));
12
+ const engine = createMaskingEngine({
13
+ enabled: false,
14
+ workspaceDir: workspace,
15
+ configPath: "missing.json",
16
+ });
17
+ assert.equal(engine, undefined);
18
+ });
19
+ test("applies built-in rules and literal keyword rules", () => {
20
+ const workspace = fs.mkdtempSync(path.join(os.tmpdir(), "gitlab-mask-"));
21
+ fs.writeFileSync(path.join(workspace, ".gitlab-mcp-mask.json"), JSON.stringify({
22
+ version: 1,
23
+ builtins: { ipv4: { replacement: "[Address]" } },
24
+ rules: [
25
+ {
26
+ id: "company",
27
+ type: "keyword",
28
+ match: "Example Corp",
29
+ replacement: "Our organization",
30
+ },
31
+ { id: "token", type: "regex", pattern: "TOKEN-[0-9]+", replacement: "[Token]" },
32
+ ],
33
+ }));
34
+ const engine = createMaskingEngine({ enabled: true, workspaceDir: workspace });
35
+ assert.ok(engine);
36
+ assert.equal(engine.maskText("Example Corp 10.20.30.40 TOKEN-123"), "Our organization [Address] [Token]");
37
+ });
38
+ test("masks nested tool text without recursively masking replacements", () => {
39
+ const workspace = fs.mkdtempSync(path.join(os.tmpdir(), "gitlab-mask-"));
40
+ fs.writeFileSync(path.join(workspace, "rules.json"), JSON.stringify({
41
+ version: 1,
42
+ rules: [
43
+ { id: "a", type: "keyword", match: "Example Corp", replacement: "Customer Corp" },
44
+ {
45
+ id: "b",
46
+ type: "keyword",
47
+ match: "Customer Corp",
48
+ replacement: "Customer organization",
49
+ },
50
+ ],
51
+ }));
52
+ const engine = createMaskingEngine({
53
+ enabled: true,
54
+ workspaceDir: workspace,
55
+ configPath: "rules.json",
56
+ });
57
+ assert.ok(engine);
58
+ const result = engine.maskToolResult({
59
+ content: [{ type: "text", text: JSON.stringify({ description: "Example Corp" }) }],
60
+ structuredContent: { nested: "Example Corp" },
61
+ });
62
+ assert.equal(result.content[0].text, '{"description":"Customer Corp"}');
63
+ assert.deepEqual(result.structuredContent, { nested: "Customer Corp" });
64
+ });
65
+ test("masks plain text blocks and returned error messages", () => {
66
+ const workspace = fs.mkdtempSync(path.join(os.tmpdir(), "gitlab-mask-"));
67
+ const engine = createMaskingEngine({ enabled: true, workspaceDir: workspace });
68
+ assert.ok(engine);
69
+ const result = engine.maskToolResult({
70
+ content: [{ type: "text", text: "Connect to 10.20.30.40 with glpat-abcdefghijklmnopqrst" }],
71
+ });
72
+ assert.equal(result.content[0].text, "Connect to [IP address] with [Token masked]");
73
+ const error = engine.maskError(new Error("Failed at 10.20.30.40"));
74
+ assert.equal(error instanceof Error && error.message, "Failed at [IP address]");
75
+ });
76
+ test("masks every documented GitLab token prefix", () => {
77
+ const workspace = fs.mkdtempSync(path.join(os.tmpdir(), "gitlab-mask-"));
78
+ const engine = createMaskingEngine({ enabled: true, workspaceDir: workspace });
79
+ assert.ok(engine);
80
+ const suffix = "abcdefghijklmnopqrst";
81
+ const prefixes = [
82
+ "glpat",
83
+ "glrt",
84
+ "glptt",
85
+ "gldt",
86
+ "glcbt",
87
+ "glsoat",
88
+ "gloas",
89
+ "glagent",
90
+ "glft",
91
+ "glimt",
92
+ ];
93
+ assert.equal(engine.maskText(prefixes.map(prefix => `${prefix}-${suffix}`).join(" ")), prefixes.map(() => "[Token masked]").join(" "));
94
+ });
95
+ test("covers the full union of overlapping secrets without merging adjacent matches", t => {
96
+ const workspace = fs.mkdtempSync(path.join(os.tmpdir(), "gitlab-mask-"));
97
+ const configPath = path.join(workspace, "rules.json");
98
+ t.after(() => {
99
+ fs.unlinkSync(configPath);
100
+ fs.rmdirSync(workspace);
101
+ });
102
+ fs.writeFileSync(configPath, JSON.stringify({
103
+ rules: [
104
+ { id: "label", type: "keyword", match: "token=glpat-", replacement: "[label]" },
105
+ { id: "first", type: "keyword", match: "abc", replacement: "[first]" },
106
+ { id: "second", type: "keyword", match: "cde", replacement: "[second]" },
107
+ { id: "third", type: "keyword", match: "efg", replacement: "[third]" },
108
+ ],
109
+ }));
110
+ const engine = createMaskingEngine({ enabled: true, configPath });
111
+ assert.ok(engine);
112
+ assert.equal(engine.maskText("token=glpat-ABCDEFGHIJKLMNOPQRST"), "[label]");
113
+ assert.equal(engine.maskText("abcdefg"), "[first]");
114
+ assert.equal(engine.maskText("abccde"), "[first][second]");
115
+ });
116
+ test("preserves plain text primitives and applies numeric keyword rules", t => {
117
+ const workspace = fs.mkdtempSync(path.join(os.tmpdir(), "gitlab-mask-"));
118
+ const configPath = path.join(workspace, "rules.json");
119
+ t.after(() => {
120
+ fs.unlinkSync(configPath);
121
+ fs.rmdirSync(workspace);
122
+ });
123
+ fs.writeFileSync(configPath, JSON.stringify({
124
+ rules: [{ id: "number", type: "keyword", match: "123456", replacement: "[number]" }],
125
+ }));
126
+ const engine = createMaskingEngine({ enabled: true, configPath });
127
+ assert.ok(engine);
128
+ const texts = ["9007199254740993\n", "123456\n", "true\n", '"ordinary text"\n'];
129
+ const result = engine.maskToolResult({ content: texts.map(text => ({ type: "text", text })) });
130
+ assert.deepEqual(result.content.map(block => block.text), ["9007199254740993\n", "[number]\n", "true\n", '"ordinary text"\n']);
131
+ assert.equal(engine.maskToolResult({
132
+ content: [{ type: "text", text: '{"123456":9007199254740993}\n' }],
133
+ }, { textFormat: "plain" }).content[0].text, '{"[number]":9007199254740993}\n');
134
+ });
135
+ test("preserves JSON numbers and formatting while masking escaped string values", t => {
136
+ const workspace = fs.mkdtempSync(path.join(os.tmpdir(), "gitlab-mask-"));
137
+ t.after(() => fs.rmdirSync(workspace));
138
+ const engine = createMaskingEngine({ enabled: true, workspaceDir: workspace });
139
+ assert.ok(engine);
140
+ const text = '{\n "id": 9007199254740993, "host": "10.20.30.\\u0034\\u0030",\n' +
141
+ ' "download_url": "http://10.20.30.40/file", "nested": ["10.20.30.40"]\n}\n';
142
+ assert.equal(engine.maskToolResult({ content: [{ type: "text", text }] }).content[0].text, '{\n "id": 9007199254740993, "host": "[IP address]",\n' +
143
+ ' "download_url": "[Download URL masked]", "nested": ["[IP address]"]\n}\n');
144
+ const unchanged = '{ "id": 9007199254740993, "value": "ordinary" }\n';
145
+ assert.equal(engine.maskToolResult({ content: [{ type: "text", text: unchanged }] }).content[0].text, unchanged);
146
+ });
147
+ test("masks compressed IPv6 addresses", () => {
148
+ const workspace = fs.mkdtempSync(path.join(os.tmpdir(), "gitlab-mask-"));
149
+ const engine = createMaskingEngine({ enabled: true, workspaceDir: workspace });
150
+ assert.ok(engine);
151
+ assert.equal(engine.maskText("Hosts: 2001:db8::1, fe80::1234, ::1, and 2001:db8:0:0:0:0:0:1"), "Hosts: [IP address], [IP address], [IP address], and [IP address]");
152
+ assert.equal(engine.maskText("Version 1:2:3 is not an IPv6 address"), "Version 1:2:3 is not an IPv6 address");
153
+ });
154
+ test("rejects invalid and empty-match regex rules", () => {
155
+ const workspace = fs.mkdtempSync(path.join(os.tmpdir(), "gitlab-mask-"));
156
+ const configPath = path.join(workspace, "bad.json");
157
+ fs.writeFileSync(configPath, JSON.stringify({ rules: [{ id: "bad", type: "regex", pattern: "", replacement: "x" }] }));
158
+ assert.throws(() => createMaskingEngine({ enabled: true, workspaceDir: workspace, configPath: "bad.json" }), /must not be empty/);
159
+ });
160
+ test("fails closed when an explicitly configured file is missing", () => {
161
+ const workspace = fs.mkdtempSync(path.join(os.tmpdir(), "gitlab-mask-"));
162
+ assert.throws(() => createMaskingEngine({ enabled: true, workspaceDir: workspace, configPath: "missing.json" }), /Configured masking config does not exist/);
163
+ assert.throws(() => createMaskingPolicyResolver({
164
+ enabled: true,
165
+ workspaceDir: workspace,
166
+ configPath: "missing.json",
167
+ }), /Configured masking config does not exist/);
168
+ });
169
+ test("selects a server-owned policy by normalized GitLab instance and project", () => {
170
+ const workspace = fs.mkdtempSync(path.join(os.tmpdir(), "gitlab-mask-"));
171
+ const policyPath = path.join(workspace, "managed-policies.json");
172
+ fs.writeFileSync(policyPath, JSON.stringify({
173
+ version: 1,
174
+ policyGroups: {
175
+ customer: {
176
+ rules: [
177
+ {
178
+ id: "customer",
179
+ type: "keyword",
180
+ match: "Customer Corp",
181
+ replacement: "[customer]",
182
+ },
183
+ ],
184
+ },
185
+ },
186
+ bindings: [
187
+ {
188
+ gitlabInstance: "https://gitlab.example.test",
189
+ projectIds: [12, 13],
190
+ policyGroup: "customer",
191
+ },
192
+ ],
193
+ }));
194
+ const resolver = createMaskingPolicyResolver({
195
+ enabled: true,
196
+ workspaceDir: workspace,
197
+ policyFilePath: "managed-policies.json",
198
+ });
199
+ assert.ok(resolver);
200
+ assert.equal(resolver
201
+ .select({ gitlabInstance: "https://gitlab.example.test/api/v4", projectIds: ["12"] })
202
+ .maskText("Customer Corp"), "[customer]");
203
+ assert.throws(() => resolver.select({
204
+ gitlabInstance: "https://another.example.test/api/v4",
205
+ projectIds: [12],
206
+ }), /No managed masking policy/);
207
+ assert.throws(() => resolver.select({ gitlabInstance: "https://gitlab.example.test", projectIds: [14] }), /No managed masking policy/);
208
+ assert.throws(() => resolver.select({ gitlabInstance: "https://gitlab.example.test", hasProjectScope: false }), /project-less tool/);
209
+ });
210
+ test("rejects a workspace group that conflicts with the server binding", () => {
211
+ const workspace = fs.mkdtempSync(path.join(os.tmpdir(), "gitlab-mask-"));
212
+ fs.writeFileSync(path.join(workspace, ".gitlab-mcp-mask.json"), JSON.stringify({ version: 2, mode: "managed", policyGroup: "one" }));
213
+ fs.writeFileSync(path.join(workspace, "managed-policies.json"), JSON.stringify({
214
+ version: 1,
215
+ policyGroups: { one: {}, two: {} },
216
+ bindings: [
217
+ { gitlabInstance: "https://gitlab.example.test", projectIds: [12], policyGroup: "two" },
218
+ ],
219
+ }));
220
+ const resolver = createMaskingPolicyResolver({
221
+ enabled: true,
222
+ workspaceDir: workspace,
223
+ policyFilePath: "managed-policies.json",
224
+ });
225
+ assert.ok(resolver);
226
+ assert.throws(() => resolver.select({ gitlabInstance: "https://gitlab.example.test", projectIds: [12] }), /does not match/);
227
+ });
228
+ test("rejects project paths and calls spanning managed policy groups", () => {
229
+ const workspace = fs.mkdtempSync(path.join(os.tmpdir(), "gitlab-mask-"));
230
+ const policyPath = path.join(workspace, "managed-policies.json");
231
+ fs.writeFileSync(policyPath, JSON.stringify({
232
+ version: 1,
233
+ policyGroups: { one: {}, two: {} },
234
+ bindings: [
235
+ { gitlabInstance: "https://gitlab.example.test", projectIds: [12], policyGroup: "one" },
236
+ { gitlabInstance: "https://gitlab.example.test", projectIds: [13], policyGroup: "two" },
237
+ ],
238
+ }));
239
+ const resolver = createMaskingPolicyResolver({
240
+ enabled: true,
241
+ workspaceDir: workspace,
242
+ policyFilePath: "managed-policies.json",
243
+ });
244
+ assert.ok(resolver);
245
+ assert.throws(() => resolver.select({
246
+ gitlabInstance: "https://gitlab.example.test",
247
+ projectIds: ["group/project"],
248
+ }), /numeric project IDs/);
249
+ assert.throws(() => resolver.select({ gitlabInstance: "https://gitlab.example.test", projectIds: [12, 13] }), /span policy groups/);
250
+ });
251
+ test("derives managed scope only from project fields declared by the tool", () => {
252
+ const globalTool = { properties: { search: { type: "string" } } };
253
+ assert.deepEqual(getManagedMaskingProjectIds(globalTool, { project_id: "12", search: "example" }), { hasProjectScope: false, projectIds: [] });
254
+ const projectTool = {
255
+ properties: { project_id: { type: "string" }, target_project_id: { type: "string" } },
256
+ };
257
+ assert.deepEqual(getManagedMaskingProjectIds(projectTool, { project_id: "12", target_project_id: "13" }), { hasProjectScope: true, projectIds: ["12", "13"] });
258
+ assert.deepEqual(getManagedMaskingProjectIds(projectTool, {}, () => "12"), { hasProjectScope: true, projectIds: ["12"] });
259
+ });
260
+ test("includes the default primary project alongside explicit and nested references", () => {
261
+ const createMergeRequest = allTools.find(tool => tool.name === "create_merge_request");
262
+ const updateWorkItem = allTools.find(tool => tool.name === "update_work_item");
263
+ assert.ok(createMergeRequest);
264
+ assert.ok(updateWorkItem);
265
+ assert.deepEqual(getManagedMaskingProjectIds(createMergeRequest.inputSchema, {
266
+ project_id: "",
267
+ target_project_id: "13",
268
+ }, () => "12"), { hasProjectScope: true, projectIds: ["12", "13"] });
269
+ assert.deepEqual(getManagedMaskingProjectIds(updateWorkItem.inputSchema, {
270
+ project_id: "",
271
+ children_to_add: [{ project_id: "13", iid: 1 }],
272
+ }, () => "12"), { hasProjectScope: true, projectIds: ["12", "13"] });
273
+ });
274
+ test("treats absent optional filters as unscoped and absent required projects as scoped", () => {
275
+ for (const name of ["list_issues", "list_merge_requests", "list_todos"]) {
276
+ const tool = allTools.find(tool => tool.name === name);
277
+ assert.ok(tool, name);
278
+ assert.deepEqual(getManagedMaskingProjectIds(tool.inputSchema, {}), {
279
+ hasProjectScope: false,
280
+ projectIds: [],
281
+ });
282
+ }
283
+ const getIssue = allTools.find(tool => tool.name === "get_issue");
284
+ assert.ok(getIssue);
285
+ assert.deepEqual(getManagedMaskingProjectIds(getIssue.inputSchema, {}), {
286
+ hasProjectScope: true,
287
+ projectIds: [],
288
+ });
289
+ const groupMergeRequests = allTools.find(tool => tool.name === "list_group_merge_requests");
290
+ assert.ok(groupMergeRequests);
291
+ assert.deepEqual(getManagedMaskingProjectIds(groupMergeRequests.inputSchema, {
292
+ group_id: "99",
293
+ source_project_id: "12",
294
+ }, () => "12"), { hasProjectScope: false, projectIds: [] });
295
+ });
296
+ test("does not use a default project for a selected group scope", () => {
297
+ const webhookTool = {
298
+ properties: {
299
+ project_id: { type: "string" },
300
+ group_id: { type: "string" },
301
+ },
302
+ };
303
+ assert.deepEqual(getManagedMaskingProjectIds(webhookTool, { group_id: "99" }, () => "12"), { hasProjectScope: false, projectIds: [] });
304
+ });
305
+ test("collects nested declared project references", () => {
306
+ const workItemTool = {
307
+ properties: {
308
+ project_id: { type: "string" },
309
+ children_to_add: {
310
+ type: "array",
311
+ items: {
312
+ type: "object",
313
+ properties: { project_id: { type: "string" }, iid: { type: "number" } },
314
+ },
315
+ },
316
+ linked_items_to_remove: {
317
+ type: "array",
318
+ items: {
319
+ type: "object",
320
+ properties: { project_id: { type: "string" }, iid: { type: "number" } },
321
+ },
322
+ },
323
+ },
324
+ };
325
+ assert.deepEqual(getManagedMaskingProjectIds(workItemTool, {
326
+ project_id: "12",
327
+ children_to_add: [{ project_id: "13", iid: 1 }],
328
+ linked_items_to_remove: [{ project_id: "14", iid: 2 }],
329
+ }), { hasProjectScope: true, projectIds: ["12", "13", "14"] });
330
+ });
331
+ test("uses the registered work item schema to reject cross-project actions", () => {
332
+ const updateWorkItem = allTools.find(tool => tool.name === "update_work_item");
333
+ assert.ok(updateWorkItem);
334
+ assert.deepEqual(getManagedMaskingProjectIds(updateWorkItem.inputSchema, {
335
+ project_id: "12",
336
+ children_to_add: [{ project_id: "13", iid: 1 }],
337
+ linked_items_to_add: [{ project_id: "14", iid: 2 }],
338
+ }), { hasProjectScope: true, projectIds: ["12", "13", "14"] });
339
+ });
340
+ test("uses the registered webhook schema without selecting a default project for a group", () => {
341
+ const listWebhooks = allTools.find(tool => tool.name === "list_webhooks");
342
+ assert.ok(listWebhooks);
343
+ assert.deepEqual(getManagedMaskingProjectIds(listWebhooks.inputSchema, { group_id: "99" }, () => "12"), { hasProjectScope: false, projectIds: [] });
344
+ });
345
+ test("allows project-less tools only with the explicit built-in fallback", () => {
346
+ const workspace = fs.mkdtempSync(path.join(os.tmpdir(), "gitlab-mask-"));
347
+ const policyPath = path.join(workspace, "managed-policies.json");
348
+ fs.writeFileSync(policyPath, JSON.stringify({
349
+ version: 1,
350
+ policyGroups: {},
351
+ bindings: [],
352
+ unboundProjectBehavior: "builtin",
353
+ }));
354
+ const resolver = createMaskingPolicyResolver({
355
+ enabled: true,
356
+ workspaceDir: workspace,
357
+ policyFilePath: "managed-policies.json",
358
+ });
359
+ assert.ok(resolver);
360
+ assert.equal(resolver
361
+ .select({ gitlabInstance: "https://gitlab.example.test", hasProjectScope: false })
362
+ .maskText("10.20.30.40"), "[IP address]");
363
+ assert.throws(() => resolver.select({ gitlabInstance: "https://gitlab.example.test", hasProjectScope: true }), /requires a project ID/);
364
+ });
365
+ test("allows only explicitly designated unscoped tools to use built-in masking", () => {
366
+ const workspace = fs.mkdtempSync(path.join(os.tmpdir(), "gitlab-mask-"));
367
+ const policyPath = path.join(workspace, "managed-policies.json");
368
+ fs.writeFileSync(policyPath, JSON.stringify({ version: 1, policyGroups: {}, bindings: [] }));
369
+ const resolver = createMaskingPolicyResolver({
370
+ enabled: true,
371
+ workspaceDir: workspace,
372
+ policyFilePath: "managed-policies.json",
373
+ });
374
+ assert.ok(resolver);
375
+ assert.equal(resolver
376
+ .select({
377
+ gitlabInstance: "https://gitlab.example.test",
378
+ hasProjectScope: false,
379
+ allowBuiltinForUnscoped: true,
380
+ })
381
+ .maskText("10.20.30.40"), "[IP address]");
382
+ assert.throws(() => resolver.select({ gitlabInstance: "https://gitlab.example.test", hasProjectScope: false }), /project-less tool/);
383
+ });
384
+ });
@@ -51,7 +51,7 @@ describe("When omitIncompleteMergeRequestPosition runs", () => {
51
51
  start_sha: "ghi",
52
52
  position_type: "text",
53
53
  }),
54
- }), /Expected string, received null/);
54
+ }), /expected string, received null/i);
55
55
  });
56
56
  });
57
57
  });
@@ -1,8 +1,7 @@
1
- import { zodToJsonSchema } from "zod-to-json-schema";
2
1
  import { toJSONSchema } from "../utils/schema.js";
3
2
  import { USE_GITLAB_WIKI, USE_MILESTONE, USE_PIPELINE, SSE, STREAMABLE_HTTP, } from "../config.js";
4
3
  import { getToolDescription } from "./tool-descriptions.js";
5
- import { ApproveMergeRequestSchema, BulkPublishDraftNotesSchema, CancelPipelineJobSchema, ErasePipelineJobSchema, CancelPipelineSchema, ConvertWorkItemTypeSchema, CreateBranchSchema, CreateDraftNoteSchema, CreateGroupSchema, CreateGroupWikiPageSchema, CreateIssueLinkSchema, CreateIssueNoteSchema, CreateIssueSchema, CreateIssueEmojiReactionSchema, CreateIssueNoteEmojiReactionSchema, ListIssueEmojiReactionsSchema, ListIssueNoteEmojiReactionsSchema, CreateLabelSchema, MarkAllTodosDoneSchema, ListTodosSchema, MarkTodoDoneSchema, CreateMergeRequestDiscussionNoteSchema, CreateMergeRequestEmojiReactionSchema, ListMergeRequestEmojiReactionsSchema, ListMergeRequestNoteEmojiReactionsSchema, CreateMergeRequestNoteSchema, CreateMergeRequestNoteEmojiReactionSchema, CreateMergeRequestSchema, CreateMergeRequestThreadSchema, CreateNoteSchema, CreateCommitStatusSchema, CreateOrUpdateFileSchema, CreatePipelineSchema, CreateProjectMilestoneSchema, CreateGroupMilestoneSchema, CreateReleaseEvidenceSchema, CreateReleaseSchema, CreateRepositorySchema, CreateTagSchema, CreateTimelineEventSchema, CreateWebhookSchema, CreateWikiPageSchema, CreateWorkItemNoteSchema, CreateWorkItemEmojiReactionSchema, CreateWorkItemNoteEmojiReactionSchema, ListWorkItemEmojiReactionsSchema, ListWorkItemNoteEmojiReactionsSchema, CreateWorkItemSchema, DeleteBranchSchema, GetProtectedBranchSchema, ListProtectedBranchesSchema, ProtectBranchSchema, UnprotectBranchSchema, UpdateDefaultBranchSchema, DeleteDraftNoteSchema, DeleteGroupMilestoneSchema, DeleteGroupWikiPageSchema, DeleteIssueLinkSchema, DeleteIssueSchema, DeleteIssueEmojiReactionSchema, DeleteIssueNoteEmojiReactionSchema, DeleteLabelSchema, DeleteMergeRequestDiscussionNoteSchema, DeleteMergeRequestNoteSchema, DeleteMergeRequestEmojiReactionSchema, DeleteMergeRequestNoteEmojiReactionSchema, DeleteProjectMilestoneSchema, DeleteReleaseSchema, DeleteTagSchema, DeleteWebhookSchema, DeleteWikiPageSchema, DeleteWorkItemEmojiReactionSchema, DeleteWorkItemNoteEmojiReactionSchema, DownloadAttachmentSchema, DownloadAttachmentRemoteSchema, DownloadJobArtifactsSchema, DownloadJobArtifactsRemoteSchema, DownloadReleaseAssetSchema, EditProjectMilestoneSchema, EditGroupMilestoneSchema, ExecuteGraphQLSchema, ForkRepositorySchema, HealthCheckSchema, GetBranchSchema, GetBranchDiffsSchema, GetCommitDiffSchema, GetCommitSchema, GetFileBlameSchema, GetDeploymentSchema, CreateDeploymentSchema, UpdateDeploymentSchema, DeploymentApprovalSchema, ListDeploymentMergeRequestsSchema, GetDraftNoteSchema, GetEnvironmentSchema, UpdateEnvironmentSchema, StopEnvironmentSchema, StopStaleEnvironmentsSchema, DeleteReviewAppEnvironmentsSchema, PipelineTriggerIdSchema, ListPipelineTriggersSchema, CreatePipelineTriggerSchema, UpdatePipelineTriggerSchema, TriggerPipelineSchema, GetFileContentsSchema, GetGroupWikiPageSchema, GetIssueLinkSchema, GetIssueSchema, GetJobArtifactFileSchema, GetLabelSchema, GetMergeRequestApprovalStateSchema, GetMergeRequestConflictsSchema, GetMergeRequestDiffsSchema, GetMergeRequestFileDiffSchema, GetMergeRequestNoteSchema, GetMergeRequestNotesSchema, GetMergeRequestSchema, GetMergeRequestVersionSchema, GetMilestoneBurndownEventsSchema, GetMilestoneIssuesSchema, GetMilestoneMergeRequestsSchema, GetGroupMilestoneSchema, GetGroupMilestoneIssuesSchema, GetGroupMilestoneMergeRequestsSchema, GetGroupMilestoneBurndownEventsSchema, GetNamespaceSchema, GetPipelineJobOutputSchema, PipelineJobControlSchema, GetPipelineSchema, GetPipelineVariablesSchema, UpdatePipelineMetadataSchema, DeletePipelineSchema, PipelineReportSchema, WaitForPipelineSchema, WaitForPipelineJobSchema, PlayPipelineJobsSchema, GetProjectEventsSchema, GetProjectMilestoneSchema, GetProjectSchema, GetReleaseSchema, GetRepositoryTreeSchema, GetTagSchema, GetTagSignatureSchema, GetTimelineEventsSchema, GetUsersSchema, GetUserSchema, WhoAmISchema, GetWebhookEventSchema, GetWikiPageSchema, GetWorkItemSchema, ListBranchesSchema, ListCommitsSchema, ListCommitStatusesSchema, ListCustomFieldDefinitionsSchema, ListDeploymentsSchema, ListDraftNotesSchema, ListEnvironmentsSchema, ListEventsSchema, ListGroupIterationsSchema, ListGroupMilestonesSchema, ListGroupProjectsSchema, ListGroupWikiPagesSchema, ListIssueDiscussionsSchema, ListIssueLinksSchema, ListIssuesSchema, ListJobArtifactsSchema, ListLabelsSchema, ListMergeRequestChangedFilesSchema, ListMergeRequestDiffsSchema, ListMergeRequestDiscussionsSchema, ListMergeRequestPipelinesSchema, ListMergeRequestVersionsSchema, ListMergeRequestsSchema, ListGroupMergeRequestsSchema, ListNamespacesSchema, ListPipelineJobsSchema, ListPipelineTriggerJobsSchema, ValidateCiLintSchema, ValidateProjectCiLintSchema, ListCiCatalogResourcesSchema, GetCiCatalogResourceSchema, ListPipelinesSchema, ListPipelineSchedulesSchema, GetPipelineScheduleSchema, ListPipelineSchedulePipelinesSchema, CreatePipelineScheduleSchema, UpdatePipelineScheduleSchema, DeletePipelineScheduleSchema, PlayPipelineScheduleSchema, TakeOwnershipPipelineScheduleSchema, GetPipelineScheduleVariableSchema, CreatePipelineScheduleVariableSchema, UpdatePipelineScheduleVariableSchema, DeletePipelineScheduleVariableSchema, ListGroupMembersSchema, ListProjectMembersSchema, ListProjectMilestonesSchema, ListProjectsSchema, ListReleasesSchema, ListTagsSchema, ListWebhookEventsSchema, ListWebhooksSchema, ListWikiPagesSchema, ListWorkItemNotesSchema, ListWorkItemStatusesSchema, ListWorkItemsSchema, MarkdownUploadSchema, MarkdownUploadRemoteSchema, MergeMergeRequestSchema, MoveWorkItemSchema, MyIssuesSchema, OrbitQuerySchema, OrbitSchemaSchema, OrbitStatusSchema, OrbitToolsSchema, PlayPipelineJobSchema, PromoteProjectMilestoneSchema, PublishDraftNoteSchema, PushFilesSchema, ResolveMergeRequestThreadSchema, RetryPipelineJobSchema, RetryPipelineSchema, SearchCodeSchema, SearchGroupCodeSchema, SearchProjectCodeSchema, SearchRepositoriesSchema, UnapproveMergeRequestSchema, UpdateDraftNoteSchema, UpdateGroupWikiPageSchema, UpdateIssueNoteSchema, UpdateIssueSchema, UpdateIssueDescriptionPatchSchema, UpdateLabelSchema, UpdateProjectSchema, UpdateMergeRequestDiscussionNoteSchema, UpdateMergeRequestNoteSchema, UpdateMergeRequestSchema, UpdateReleaseSchema, UpdateWebhookSchema, UpdateWikiPageSchema, UpdateWorkItemSchema, VerifyNamespaceSchema, ListProjectVariablesSchema, GetProjectVariableSchema, CreateProjectVariableSchema, UpdateProjectVariableSchema, DeleteProjectVariableSchema, ListGroupVariablesSchema, GetGroupVariableSchema, CreateGroupVariableSchema, UpdateGroupVariableSchema, DeleteGroupVariableSchema, GetDependencyProxySettingsSchema, UpdateDependencyProxySettingsSchema, ListDependencyProxyBlobsSchema, PurgeDependencyProxyCacheSchema, ListProjectVulnerabilitiesSchema, GetVulnerabilitySchema, DismissVulnerabilitySchema, ConfirmVulnerabilitySchema, } from "../schemas.js";
4
+ import { ApproveMergeRequestSchema, BulkPublishDraftNotesSchema, CancelPipelineJobSchema, ErasePipelineJobSchema, CancelPipelineSchema, ConvertWorkItemTypeSchema, CreateBranchSchema, CreateDraftNoteSchema, CreateGroupSchema, CreateGroupWikiPageSchema, CreateIssueLinkSchema, CreateIssueNoteSchema, CreateIssueSchema, CreateIssueEmojiReactionSchema, CreateIssueNoteEmojiReactionSchema, ListIssueEmojiReactionsSchema, ListIssueNoteEmojiReactionsSchema, CreateLabelSchema, MarkAllTodosDoneSchema, ListTodosSchema, MarkTodoDoneSchema, CreateMergeRequestDiscussionNoteSchema, CreateMergeRequestEmojiReactionSchema, ListMergeRequestEmojiReactionsSchema, ListMergeRequestNoteEmojiReactionsSchema, CreateMergeRequestNoteSchema, CreateMergeRequestNoteEmojiReactionSchema, CreateMergeRequestSchema, CreateMergeRequestThreadSchema, CreateNoteSchema, CreateCommitStatusSchema, CreateOrUpdateFileSchema, CreatePipelineSchema, CreateProjectMilestoneSchema, CreateGroupMilestoneSchema, CreateReleaseEvidenceSchema, CreateReleaseSchema, CreateRepositorySchema, CreateTagSchema, CreateTimelineEventSchema, CreateWebhookSchema, CreateWikiPageSchema, CreateWorkItemNoteSchema, CreateWorkItemEmojiReactionSchema, CreateWorkItemNoteEmojiReactionSchema, ListWorkItemEmojiReactionsSchema, ListWorkItemNoteEmojiReactionsSchema, CreateWorkItemSchema, DeleteBranchSchema, GetProtectedBranchSchema, ListProtectedBranchesSchema, ProtectBranchSchema, UnprotectBranchSchema, UpdateDefaultBranchSchema, DeleteDraftNoteSchema, DeleteGroupMilestoneSchema, DeleteGroupWikiPageSchema, DeleteIssueLinkSchema, DeleteIssueSchema, DeleteIssueEmojiReactionSchema, DeleteIssueNoteEmojiReactionSchema, DeleteLabelSchema, DeleteMergeRequestDiscussionNoteSchema, DeleteMergeRequestNoteSchema, DeleteMergeRequestEmojiReactionSchema, DeleteMergeRequestNoteEmojiReactionSchema, DeleteProjectMilestoneSchema, DeleteReleaseSchema, DeleteTagSchema, DeleteWebhookSchema, DeleteWikiPageSchema, DeleteWorkItemEmojiReactionSchema, DeleteWorkItemNoteEmojiReactionSchema, DownloadAttachmentSchema, DownloadAttachmentRemoteSchema, DownloadJobArtifactsSchema, DownloadJobArtifactsRemoteSchema, DownloadReleaseAssetSchema, EditProjectMilestoneSchema, EditGroupMilestoneSchema, ExecuteGraphQLSchema, ForkRepositorySchema, HealthCheckSchema, GetBranchSchema, GetBranchDiffsSchema, GetCommitDiffSchema, GetCommitSchema, GetFileBlameSchema, GetDeploymentSchema, CreateDeploymentSchema, UpdateDeploymentSchema, DeploymentApprovalSchema, ListDeploymentMergeRequestsSchema, GetDraftNoteSchema, GetEnvironmentSchema, UpdateEnvironmentSchema, StopEnvironmentSchema, StopStaleEnvironmentsSchema, DeleteReviewAppEnvironmentsSchema, PipelineTriggerIdSchema, ListPipelineTriggersSchema, CreatePipelineTriggerSchema, UpdatePipelineTriggerSchema, TriggerPipelineSchema, GetFileContentsSchema, GetGroupWikiPageSchema, GetIssueLinkSchema, GetIssueSchema, GetJobArtifactFileSchema, GetLabelSchema, GetMergeRequestApprovalStateSchema, GetMergeRequestConflictsSchema, GetMergeRequestDiffsSchema, GetMergeRequestFileDiffSchema, GetMergeRequestDiscussionSchema, GetMergeRequestNoteSchema, GetMergeRequestNotesSchema, GetMergeRequestSchema, GetMergeRequestVersionSchema, GetMilestoneBurndownEventsSchema, GetMilestoneIssuesSchema, GetMilestoneMergeRequestsSchema, GetGroupMilestoneSchema, GetGroupMilestoneIssuesSchema, GetGroupMilestoneMergeRequestsSchema, GetGroupMilestoneBurndownEventsSchema, GetNamespaceSchema, GetPipelineJobOutputSchema, PipelineJobControlSchema, GetPipelineSchema, GetPipelineVariablesSchema, UpdatePipelineMetadataSchema, DeletePipelineSchema, PipelineReportSchema, WaitForPipelineSchema, WaitForPipelineJobSchema, PlayPipelineJobsSchema, GetProjectEventsSchema, GetProjectMilestoneSchema, GetProjectSchema, GetReleaseSchema, GetRepositoryTreeSchema, GetTagSchema, GetTagSignatureSchema, GetTimelineEventsSchema, GetUsersSchema, GetUserSchema, WhoAmISchema, GetWebhookEventSchema, GetWikiPageSchema, GetWorkItemSchema, ListBranchesSchema, ListCommitsSchema, ListCommitStatusesSchema, ListCustomFieldDefinitionsSchema, ListDeploymentsSchema, ListDraftNotesSchema, ListEnvironmentsSchema, ListEventsSchema, ListGroupIterationsSchema, ListGroupMilestonesSchema, ListGroupProjectsSchema, ListGroupWikiPagesSchema, ListIssueDiscussionsSchema, ListIssueLinksSchema, ListIssuesSchema, ListJobArtifactsSchema, ListLabelsSchema, ListMergeRequestChangedFilesSchema, ListMergeRequestDiffsSchema, ListMergeRequestDiscussionsSchema, ListMergeRequestPipelinesSchema, ListMergeRequestVersionsSchema, ListMergeRequestsSchema, ListGroupMergeRequestsSchema, ListNamespacesSchema, ListPipelineJobsSchema, ListPipelineTriggerJobsSchema, ValidateCiLintSchema, ValidateProjectCiLintSchema, ListCiCatalogResourcesSchema, GetCiCatalogResourceSchema, ListPipelinesSchema, ListPipelineSchedulesSchema, GetPipelineScheduleSchema, ListPipelineSchedulePipelinesSchema, CreatePipelineScheduleSchema, UpdatePipelineScheduleSchema, DeletePipelineScheduleSchema, PlayPipelineScheduleSchema, TakeOwnershipPipelineScheduleSchema, GetPipelineScheduleVariableSchema, CreatePipelineScheduleVariableSchema, UpdatePipelineScheduleVariableSchema, DeletePipelineScheduleVariableSchema, ListGroupMembersSchema, ListProjectMembersSchema, ListProjectMilestonesSchema, ListProjectsSchema, ListReleasesSchema, ListTagsSchema, ListWebhookEventsSchema, ListWebhooksSchema, ListWikiPagesSchema, ListWorkItemNotesSchema, ListWorkItemStatusesSchema, ListWorkItemsSchema, MarkdownUploadSchema, MarkdownUploadRemoteSchema, MergeMergeRequestSchema, MoveWorkItemSchema, MyIssuesSchema, OrbitQuerySchema, OrbitSchemaSchema, OrbitStatusSchema, OrbitToolsSchema, PlayPipelineJobSchema, PromoteProjectMilestoneSchema, PublishDraftNoteSchema, PushFilesSchema, ResolveMergeRequestThreadSchema, RetryPipelineJobSchema, RetryPipelineSchema, SearchCodeSchema, SearchGroupCodeSchema, SearchProjectCodeSchema, SearchRepositoriesSchema, UnapproveMergeRequestSchema, UpdateDraftNoteSchema, UpdateGroupWikiPageSchema, UpdateIssueNoteSchema, UpdateIssueSchema, UpdateIssueDescriptionPatchSchema, UpdateLabelSchema, UpdateProjectSchema, UpdateMergeRequestDiscussionNoteSchema, UpdateMergeRequestNoteSchema, UpdateMergeRequestSchema, UpdateReleaseSchema, UpdateWebhookSchema, UpdateWikiPageSchema, UpdateWorkItemSchema, VerifyNamespaceSchema, ListProjectVariablesSchema, GetProjectVariableSchema, CreateProjectVariableSchema, UpdateProjectVariableSchema, DeleteProjectVariableSchema, ListGroupVariablesSchema, GetGroupVariableSchema, CreateGroupVariableSchema, UpdateGroupVariableSchema, DeleteGroupVariableSchema, GetDependencyProxySettingsSchema, UpdateDependencyProxySettingsSchema, ListDependencyProxyBlobsSchema, PurgeDependencyProxyCacheSchema, ListProjectVulnerabilitiesSchema, GetVulnerabilitySchema, DismissVulnerabilitySchema, ConfirmVulnerabilitySchema, } from "../schemas.js";
6
5
  const IS_REMOTE = SSE || STREAMABLE_HTTP;
7
6
  // Define all available tools
8
7
  export const allTools = [
@@ -39,7 +38,7 @@ export const allTools = [
39
38
  {
40
39
  name: "execute_graphql",
41
40
  description: "Execute a GitLab GraphQL query",
42
- inputSchema: zodToJsonSchema(ExecuteGraphQLSchema),
41
+ inputSchema: toJSONSchema(ExecuteGraphQLSchema),
43
42
  },
44
43
  {
45
44
  name: "create_or_update_file",
@@ -196,6 +195,11 @@ export const allTools = [
196
195
  description: "List discussion items for a merge request",
197
196
  inputSchema: toJSONSchema(ListMergeRequestDiscussionsSchema),
198
197
  },
198
+ {
199
+ name: "get_merge_request_discussion",
200
+ description: "Get a single discussion item for a merge request",
201
+ inputSchema: toJSONSchema(GetMergeRequestDiscussionSchema),
202
+ },
199
203
  {
200
204
  name: "delete_merge_request_discussion_note",
201
205
  description: "Delete a discussion note on a merge request",
@@ -917,7 +921,7 @@ export const allTools = [
917
921
  },
918
922
  {
919
923
  name: "health_check",
920
- description: "Verify server status and authentication. When authenticated, also reports the GitLab instance version from GET /api/v4/version (version, revision, enterprise). Version lookup failures do not fail the health check — those fields are omitted.",
924
+ description: "Verify server status and authentication. Always reports the MCP server version (mcp_server_version). When authenticated, also reports the GitLab instance version from GET /api/v4/version (version, revision, enterprise). Version lookup failures do not fail the health check — those fields are omitted.",
921
925
  inputSchema: toJSONSchema(HealthCheckSchema),
922
926
  },
923
927
  {
@@ -1287,6 +1291,7 @@ export const readOnlyTools = new Set([
1287
1291
  "get_draft_note",
1288
1292
  "list_draft_notes",
1289
1293
  "mr_discussions",
1294
+ "get_merge_request_discussion",
1290
1295
  "list_issues",
1291
1296
  "list_todos",
1292
1297
  "my_issues",
@@ -1595,6 +1600,7 @@ export const TOOLSET_DEFINITIONS = [
1595
1600
  "list_group_merge_requests",
1596
1601
  "get_branch_diffs",
1597
1602
  "mr_discussions",
1603
+ "get_merge_request_discussion",
1598
1604
  "create_merge_request_note",
1599
1605
  "update_merge_request_note",
1600
1606
  "delete_merge_request_note",
@@ -22,6 +22,7 @@ const TOOL_GUIDANCE = {
22
22
  create_merge_request_thread: "Use this to start a review thread on a merge request; use `create_merge_request_note` for an unthreaded note and `create_merge_request_discussion_note` to reply to an existing thread. The operation creates remote review content, requires note permission, and returns the discussion or a position/permission/validation error.",
23
23
  resolve_merge_request_thread: "Use this to mark an existing merge request review thread resolved; use `update_merge_request_discussion_note` when the note text itself must change. The operation changes review state, requires permission to resolve discussions, and returns the updated discussion or a missing-thread/permission error.",
24
24
  mr_discussions: "Use this to list complete discussion threads for a merge request; use `get_merge_request_notes` when only flat notes are needed. It is read-only and returns threaded discussion items, while invalid merge request identifiers, missing resources, and permission failures are reported as errors.",
25
+ get_merge_request_discussion: "Use this to fetch one known merge request discussion by discussion identifier; use `mr_discussions` for a collection and `get_merge_request_note` for a flat note. It is read-only and returns the discussion item or an error for an invalid identifier, missing discussion, or insufficient permission.",
25
26
  create_merge_request_discussion_note: "Use this to reply inside an existing merge request discussion; use `create_merge_request_thread` to start a new thread and `create_merge_request_note` for a top-level note. The operation creates remote review content, requires note permission, and returns the new note or a missing-discussion/position/permission error.",
26
27
  get_merge_request_note: "Use this to fetch one known merge request note by note identifier; use `get_merge_request_notes` for a collection and `mr_discussions` for threaded context. It is read-only and returns the note object or an error for an invalid identifier, missing note, or insufficient permission.",
27
28
  get_merge_request_notes: "Use this to list flat notes on a merge request; use `mr_discussions` when thread structure and resolution state are required. It is read-only and returns note records, while invalid identifiers, missing resources, and pagination or permission errors are reported by GitLab.",