Skip to content

Scratchpad exploration tools fail on double-encoded JSON from MCP responses #111

Description

@Shearerbeard

Problem

Some MCP tool servers return responses with double-encoded JSON, e.g.:

{"result": "{\"pods\": [{\"name\": \"api-server-abc\", ...}]}"}

When this is written to the scratchpad as an artifact, the exploration tools (get_in, iterate_over, schema, etc.) can't parse the inner content because they encounter a string where they expect an object/array.

This is the root cause of some remaining max_depth failures in orchestration — workers spend turns trying to extract data from artifacts that the exploration tools can't navigate, eventually exhausting their turn budget.

Expected Behavior

Scratchpad should detect and unwrap double-encoded JSON at write time, or exploration tools should transparently handle string-valued JSON fields that contain parseable JSON.

Impact

  • Workers waste turns on unparseable artifacts, leading to avoidable max_depth exhaustion
  • Affects any MCP server that wraps responses in an extra layer of JSON encoding

Activity

  1. self-assigned this
    on May 12, 2026
  2. removed their assignment
    on Jun 5, 2026
  3. Shearerbeard commented on Jul 17, 2026

    @Shearerbeard
    CollaboratorAuthor

    @justintime4tea did we handle this already somewhere?

  4. dhable commented on Sep 8, 2026

    @dhable
    Contributor

    There is a test case covering this - test_companion_extraction_escaped_json (source). Closing this out since it's already fixed and tested.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions