Skip to content

[Bug]: void preview tools emit structuredContent: null, which violates the MCP spec and makes every client report a failure #5583

Description

@JorgeMenaDev

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Summary

The five void-returning preview tools declare success: Schema.Null. That produces an outputSchema of {"type": "null"} and a response with structuredContent: null.

Per the MCP spec, structuredContent is "returned as a JSON object", and "Servers MUST provide structured results that conform to this schema. Clients SHOULD validate structured results against this schema." (spec 2025-06-18, Tools § Structured Content / Output Schema)

null is not a JSON object, so conformant clients reject the response:

MCP server "t3-code" returned a malformed result that failed schema validation: [
  {
    "expected": "record",
    "code": "invalid_type",
    "path": ["structuredContent"],
    "message": "Invalid input: expected record, received null"
  }
]

The damaging part: the underlying action actually succeeds. The agent is told it failed. In a visible tab, preview_click navigates the page correctly and still reports this error — so agents retry, conclude the browser tooling is broken, and abandon the lane. I watched two separate models do exactly that today before I traced it.

Affected tools

All five that .pipe(Effect.as(null)) in apps/server/src/mcp/toolkits/preview/handlers.ts and declare success: Schema.Null in tools.ts:

  • preview_click (tools.ts:120)
  • preview_type (tools.ts:131)
  • preview_press (tools.ts:142)
  • preview_scroll (tools.ts:153)
  • preview_wait_for (tools.ts:175)

preview_evaluate declares success: Schema.Unknown and is unaffected in practice.

Steps to reproduce

  1. Start T3 Code Desktop (reproduced on server 0.0.32-nightly.20260806.1015).
  2. From any MCP client, preview_open on https://example.com — succeeds.
  3. Call preview_click with locator: "role=link[name='Learn more']" — returns the schema error above.
  4. Call preview_evaluate with location.href — the page has navigated to https://www.iana.org/help/example-domains. The click worked.
  5. preview_scroll with deltaY: 100 — same error, confirming it is the whole Schema.Null class and not click-specific.

Reproduced across

3 models, 4 threads, 2 independent MCP clients (Claude Code and OpenCode), every targeting style — Playwright locator, legacy selector, and raw x/y coordinates:

Client Model Result
OpenCode opencode-go/deepseek-v4-flash schema error, 4 targeting styles
OpenCode opencode-go/grok-4.5 schema error, 3 targeting styles
Claude Code claude-opus-5 schema error, click + scroll, visible and hidden tabs

Expected

Void tools return an empty JSON object rather than null — e.g. success: Schema.Struct({}), or a small record such as { ok: true } if a positive signal is preferred. Either conforms to the spec and lets clients see the success the server already achieved.

Related

Activity

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

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