Skip to content

MCP tools being called with incorrect escaping for parameters #27079

Closed

Description

@lowlyocean

Description

After recent OpenCode updates, Qwen 3.6 35B-A3B now encounters the following:

The webfetch tool was called with invalid arguments: SchemaError(Expected "text" | "markdown" | "html", got "\"markdown\""
  at ["format"]).
Please rewrite the input so it satisfies the expected schema.

Another example: marekrost/mcp-server-spreadsheet#3

Plugins

No response

OpenCode version

dev

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

WSL

Terminal

No response

Activity

  1. github-actions commented on May 12, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. lowlyocean commented on May 12, 2026

    @lowlyocean
    Author

    It isn't a duplicate of those

  3. lznoob commented on May 15, 2026

    @lznoob

    packages/opencode/src/tool/webfetch.ts, line 20:
    remove .pipe(Schema.optional, Schema.withDecodingDefault(Effect.succeed("markdown" as const))),

    Should look like this:

    export const Parameters = Schema.Struct({
      url: Schema.String.annotate({ description: "The URL to fetch content from" }),
      format: Schema.Literals(["text", "markdown", "html"])
        .annotate({
          description: "The format to return the content in (text, markdown, or html). Defaults to markdown.",
          default: "markdown",
        }),
      timeout: Schema.optional(Schema.Number).annotate({ description: "Optional timeout in seconds (max 120)" }),
    })
    Image

    The original version sends this schema.format:

          "format": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "text",
                  "markdown",
                  "html"
                ],
                "description": "The format to return the content in (text, markdown, or html). Defaults to markdown.",
                "default": "markdown"
              },
              {
                "type": "null"
              }
            ]
          }

    Fixed:

          "format": {
            "type": "string",
            "enum": [
              "text",
              "markdown",
              "html"
            ],
            "description": "The format to return the content in (text, markdown, or html). Defaults to markdown.",
            "default": "markdown"
          }

    Not sure what exactly is wrong, though.

  4. lowlyocean commented on May 15, 2026

    @lowlyocean
    Author

    @kitlangton Looks like your recent PR a few days ago may have introduced a regression as indicated above, can you check please?
    #26956

  5. frankfletcher commented on May 31, 2026

    @frankfletcher

    same issue.
    OpenCode v1.15.13
    Ubuntu Linux v26.04
    Qwen 3.6 27b running on beellama.cpp server.

  6. frankfletcher commented on Jun 1, 2026

    @frankfletcher

    The workaround I found was to create a custom rules markdown with the following:

    ## webfetch Tool Usage
    
    When calling the `webfetch` tool, **never** include the `format` parameter. Omitting it defaults to `markdown`, which is the desired behavior. Only provide the `url` parameter.
    
    **Correct:**
    ```json
    {
      "url": "https://example.com"
    }
    ```
    

    I added this line in my opencode.jsonc to make it universal, but you could just add it to your AGENTS.md or whatever. "instructions": ["~/.config/opencode/custom_rules.md"],

  7. nexxeln commented on Jun 1, 2026

    @nexxeln
    Contributor

    will be fixed in next release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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