Skip to content

[GitLab] create_or_update_file tool schema broken with zod v4 — zodToJsonSchema returns empty schema (missing "type": "object") #3530

@xieliuduo-ai

Description

@xieliuduo-ai

Bug Description

The create_or_update_file tool (and likely all other tools) in @modelcontextprotocol/server-gitlab@2025.4.25 produces an invalid JSON Schema that breaks Claude API and other LLM tool-calling APIs.

The generated inputSchema is:

{
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Missing [type](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html), properties, and required — making it an empty/invalid schema.

Root Cause
The package has "zod-to-json-schema": "^3.23.5" as a dependency, but zod resolves to v4.3.6 (zod v4). zod-to-json-schema@3.x does not support zod v4 — calling [zodToJsonSchema()](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html) on a zod v4 schema silently returns an empty object.

Reproduction


npx -y @modelcontextprotocol/server-gitlab  # installs with zod 4.x

import { zodToJsonSchema } from 'zod-to-json-schema';
import { CreateOrUpdateFileSchema } from './dist/schemas.js';

console.log(JSON.stringify(zodToJsonSchema(CreateOrUpdateFileSchema), null, 2));
// Output: { "$schema": "http://json-schema.org/draft-07/schema#" }
// Expected: { "type": "object", "properties": { ... }, "required": [ ... ] }


Versions
@modelcontextprotocol/server-gitlab: 2025.4.25
zod (resolved): 4.3.6
zod-to-json-schema: 3.25.1
Impact
This completely breaks all tool-calling for any MCP client using this server. For example, Claude API returns:

Since all tools are validated before any request, this blocks every conversation — not just GitLab-related ones.

Suggested Fix
Either:

Pin zod to v3 in [package.json](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html): "zod": "^3.23.0" (quick fix)
Upgrade zod-to-json-schema to v4+ which supports zod v4 (proper fix)
Or add both zod@4 + zod-to-json-schema@4 as a coordinated upgrade
Environment
OS: macOS
Node.js: v22.x
MCP client: VS Code GitHub Copilot






Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions