Skip to content

MCP: devices and apps return a top-level array as structuredContent, which spec-enforcing MCP clients (e.g. Claude Code) reject — the tools are unusable even though the daemon executes them successfully #1340

Description

@oyekissliu-ux

Environment

  • agent-device version: 0.19.3 (npm, latest at time of writing)
  • Node: v24.15.0
  • macOS: Darwin 25.4.0
  • MCP client: Claude Code, server registered as agent-device mcp in mcpServers
  • Device: physical iPhone 14 (also reproduces with no device connected — devices fails the same way)

Description

When agent-device is registered as an MCP server in Claude Code, calling the devices or apps tools always fails on the client side with a schema validation error, because the tool result's structuredContent is a JSON array.

Per the MCP specification, CallToolResult.structuredContent must be a JSON object, and clients are allowed to validate that. Claude Code does, so the call is rejected before the agent ever sees the result:

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

The daemon side is fine — events.ndjson shows both commands completing successfully at the exact time of the rejected calls:

{"st":"...","kind":"request.finished","command":"devices","status":"ok","summary":"Finished devices","details":{"durationMs":1791}}
{"st":"...","kind":"request.finished","command":"apps","status":"ok","summary":"Finished apps","details":{"durationMs":1818}}

So the failure is purely in the MCP result shape. Other tools we exercised (session, appstate, snapshot, screenshot, open) return object-shaped structuredContent and validate fine.

This effectively breaks the device-resolution step of any MCP-driven workflow in Claude Code: an agent cannot enumerate devices or installed apps through MCP and has to shell out to the CLI instead.

Reproducible Demo

  1. Register agent-device as an MCP server in Claude Code (mcpServers: { "agent-device": { "command": "agent-device", "args": ["mcp"] } }).
  2. From a Claude Code session, invoke the devices MCP tool (no parameters), or apps with a device selector.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions