@zereight/mcp-gitlab 2.3.15 → 2.3.16-next.183

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.
package/build/index.js CHANGED
@@ -254,7 +254,7 @@ function createServer() {
254
254
  const isPlainTextResult = toolName === "get_pipeline_job_output" ||
255
255
  toolName === "get_job_artifact_file" ||
256
256
  (toolName === "download_release_asset" && !IS_REMOTE);
257
- const summarized = applyListSummaryToToolResult(redactErrorResultUrls(result), listSummaryRequested);
257
+ const summarized = applyListSummaryToToolResult(redactErrorResultUrls(result), listSummaryRequested, toolName);
258
258
  const filtered = applyJmespathToToolResult(summarized, jmespathExpression, {
259
259
  ...completionOptions,
260
260
  maskValue: maskingEngine ? (value) => maskingEngine.maskValue(value) : undefined,
@@ -26,6 +26,30 @@ const SUMMARY_FIELDS = [
26
26
  "draft",
27
27
  "updated_at",
28
28
  ];
29
+ /**
30
+ * Extra fields a tool's summary keeps on top of SUMMARY_FIELDS: the access and
31
+ * protection fields these tools exist to answer (#942).
32
+ */
33
+ const TOOL_SUMMARY_FIELDS = {
34
+ list_branches: [
35
+ "protected",
36
+ "default",
37
+ "merged",
38
+ "can_push",
39
+ "developers_can_push",
40
+ "developers_can_merge",
41
+ ],
42
+ list_protected_branches: [
43
+ "push_access_levels",
44
+ "merge_access_levels",
45
+ "unprotect_access_levels",
46
+ "allow_force_push",
47
+ "code_owner_approval_required",
48
+ ],
49
+ list_protected_tags: ["create_access_levels"],
50
+ list_project_members: ["access_level", "expires_at"],
51
+ list_group_members: ["access_level", "expires_at"],
52
+ };
29
53
  /** Fields kept per note when a summarized item carries discussion `notes`. */
30
54
  const NOTE_SUMMARY_FIELDS = ["id", "body", "created_at", "resolved"];
31
55
  const NATIVE_SUMMARY_TOOLS = new Set(["list_webhook_events"]);
@@ -43,7 +67,7 @@ const LIST_SUMMARY_DEFAULT_EXCLUDED_TOOLS = new Set([
43
67
  "list_webhooks", // url, event flags
44
68
  "list_pipeline_triggers", // description
45
69
  "list_job_artifacts", // path, type, size
46
- "list_branches", // protected, default, merged
70
+ // Small replies whose access fields are the point; summary: true keeps them (TOOL_SUMMARY_FIELDS).
47
71
  "list_protected_branches", // *_access_levels, allow_force_push
48
72
  "list_protected_tags", // create_access_levels
49
73
  "list_project_members", // access_level, expires_at
@@ -143,12 +167,12 @@ function summarizeNote(note) {
143
167
  }
144
168
  return summarized;
145
169
  }
146
- function summarizeItem(item) {
170
+ function summarizeItem(item, extraFields = []) {
147
171
  if (!isRecord(item)) {
148
172
  return item;
149
173
  }
150
174
  const summarized = {};
151
- for (const field of SUMMARY_FIELDS) {
175
+ for (const field of [...SUMMARY_FIELDS, ...extraFields]) {
152
176
  if (field in item) {
153
177
  summarized[field] = item[field];
154
178
  }
@@ -165,19 +189,22 @@ function summarizeItem(item) {
165
189
  }
166
190
  return Object.keys(summarized).length > 0 ? summarized : item;
167
191
  }
168
- export function summarizeListPayload(data) {
192
+ /** With `toolName`, the summary also keeps that tool's TOOL_SUMMARY_FIELDS. */
193
+ export function summarizeListPayload(data, toolName) {
194
+ const extraFields = (toolName && TOOL_SUMMARY_FIELDS[toolName]) || [];
195
+ const summarize = (item) => summarizeItem(item, extraFields);
169
196
  if (Array.isArray(data)) {
170
- return data.map(summarizeItem);
197
+ return data.map(summarize);
171
198
  }
172
199
  if (isRecord(data) && Array.isArray(data.items)) {
173
- return { ...data, items: data.items.map(summarizeItem) };
200
+ return { ...data, items: data.items.map(summarize) };
174
201
  }
175
202
  return data;
176
203
  }
177
204
  function isTextContentBlock(value) {
178
205
  return typeof value === "object" && value !== null;
179
206
  }
180
- export function applyListSummaryToToolResult(result, requested) {
207
+ export function applyListSummaryToToolResult(result, requested, toolName) {
181
208
  if (!requested || result.isError) {
182
209
  return result;
183
210
  }
@@ -190,7 +217,7 @@ export function applyListSummaryToToolResult(result, requested) {
190
217
  }
191
218
  try {
192
219
  const parsed = JSON.parse(block.text);
193
- return { ...block, text: JSON.stringify(summarizeListPayload(parsed)) };
220
+ return { ...block, text: JSON.stringify(summarizeListPayload(parsed, toolName)) };
194
221
  }
195
222
  catch {
196
223
  return block;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zereight/mcp-gitlab",
3
- "version": "2.3.15",
3
+ "version": "2.3.16-next.183",
4
4
  "mcpName": "io.github.zereight/gitlab-mcp",
5
5
  "description": "GitLab MCP server for projects, merge requests, issues, pipelines, wiki, releases, and more",
6
6
  "keywords": [