@zereight/mcp-gitlab 2.3.13 → 2.3.14-next.170

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,3 +1,4 @@
1
+ import { omitInvalidStructuredContent } from "../utils/structured-content.js";
1
2
  import { buildToolReplayCommand } from "./replay-command.js";
2
3
  const PREVIEW_ARRAY_ITEMS = 5;
3
4
  const PREVIEW_TEXT_CHARS = 1500;
@@ -35,6 +36,10 @@ export function compactMcpToolResult(input) {
35
36
  isError: false,
36
37
  };
37
38
  }
39
+ /** Last exit of a tools/call result: compaction, then structuredContent is object-or-absent (#675). */
40
+ export function finalizeToolCallResult(input) {
41
+ return omitInvalidStructuredContent(compactMcpToolResult(input));
42
+ }
38
43
  function toolResultRecord(value) {
39
44
  if (isRecord(value)) {
40
45
  return value;
package/build/index.js CHANGED
@@ -86,7 +86,7 @@ import { isCliInvocation, resolveCli } from "./cli/router.js";
86
86
  import { runDoctorWithOptionalProbe, packageVersion, } from "./cli/doctor.js";
87
87
  import { runSetup } from "./cli/setup.js";
88
88
  import { formatCliError, formatToolOutput } from "./cli/output.js";
89
- import { compactMcpToolResult, readOwnRecord } from "./cli/compact-mcp-result.js";
89
+ import { finalizeToolCallResult, readOwnRecord } from "./cli/compact-mcp-result.js";
90
90
  import { compileDeniedToolsRegex } from "./tools/denied-regex.js";
91
91
  import { createGitLabOAuthProvider } from "./oauth-proxy.js";
92
92
  import { parseAllowedRedirectUris, RedirectUriPolicy } from "./oauth-consent.js";
@@ -265,7 +265,8 @@ function createServer() {
265
265
  textFormat: isPlainTextResult ? "plain" : "json",
266
266
  })
267
267
  : filtered;
268
- return compactMcpToolResult({
268
+ // Last exit for successful results: structuredContent is object-or-absent (#675).
269
+ return finalizeToolCallResult({
269
270
  result: masked,
270
271
  enabled: shouldCompactToolResult(toolName, GITLAB_MCP_COMPACT_RESULTS, GITLAB_MCP_COMPACT_TOOL_NAMES),
271
272
  maxChars: GITLAB_MCP_COMPACT_RESULT_CHARS,
@@ -1,4 +1,5 @@
1
1
  import jmespath from "jmespath";
2
+ import { isJsonObject } from "./structured-content.js";
2
3
  /** MCP-only argument; stripped before GitLab handlers run (issue #766). */
3
4
  export const JMESPATH_TOOL_ARGUMENT = "jmespath";
4
5
  export const JMESPATH_TOOL_ARGUMENT_DESCRIPTION = "Optional JMESPath expression filtering the JSON result before return.";
@@ -33,9 +34,6 @@ export function applyJmespathFilter(data, expression) {
33
34
  function isContentBlock(value) {
34
35
  return Boolean(value && typeof value === "object");
35
36
  }
36
- function isJsonObject(value) {
37
- return typeof value === "object" && value !== null && !Array.isArray(value);
38
- }
39
37
  function prepareDataForJmespath(data, maskValue) {
40
38
  return maskValue ? maskValue(data) : data;
41
39
  }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * MCP `CallToolResult.structuredContent` must be a JSON object when present
3
+ * (SDK schema: `z.record(z.string(), z.unknown()).optional()`). A validating
4
+ * client rejects the whole tools/call response otherwise, e.g.
5
+ * `expected record, received array` (issue #675). No tool here declares an
6
+ * outputSchema, so a non-object payload is dropped rather than wrapped; the
7
+ * text content block is left untouched.
8
+ */
9
+ export function isJsonObject(value) {
10
+ return typeof value === "object" && value !== null && !Array.isArray(value);
11
+ }
12
+ export function omitInvalidStructuredContent(result) {
13
+ if (!("structuredContent" in result) || isJsonObject(result.structuredContent)) {
14
+ return result;
15
+ }
16
+ const { structuredContent: _dropped, ...rest } = result;
17
+ return rest;
18
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zereight/mcp-gitlab",
3
- "version": "2.3.13",
3
+ "version": "2.3.14-next.170",
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": [