Skip to content

Clarify payload.json structure in large payload instructions#883

Merged
lpcox merged 2 commits intomainfrom
claude/update-payload-instructions
Feb 11, 2026
Merged

Clarify payload.json structure in large payload instructions#883
lpcox merged 2 commits intomainfrom
claude/update-payload-instructions

Conversation

@Claude
Copy link
Contributor

@Claude Claude AI commented Feb 11, 2026

Agents were discovering the payload.json file structure through trial and error rather than immediately understanding what the file contains and how to use it.

Changes

Updated PayloadTruncatedInstructions constant (internal/middleware/jqschema.go:22)

  • Explicitly states payload.json contains complete original response data in valid JSON format
  • Clarifies payloadSchema shows structure/types only, not actual values
  • Directs agents to read the JSON file at payloadPath for full data

Enhanced AGENTS.md (lines 393-399)

  • Added "Understanding the payload.json File" section
  • Provides concrete parsing examples: cat payload.json | jq ., JSON.parse(fs.readFileSync(path))
  • Distinguishes between schema (types) and payload file (values)

Updated large-payload-tester.md (lines 14-23)

  • Added "Understanding the Response Format" section documenting each field
  • Emphasizes payload.json is valid JSON with complete response data

Enhanced middleware README.md (lines 71-90)

  • Added code examples in bash/jq, Node.js, and Python for reading payload files
  • Explains what each metadata field contains

Example

The response now includes clear instructions:

{
  "agentInstructions": "The payload was too large for an MCP response. The complete original response data is saved as a JSON file at payloadPath. The file contains valid JSON that can be parsed directly. The payloadSchema shows the structure and types of fields in the full response, but not the actual values. To access the full data with all values, read and parse the JSON file at payloadPath.",
  "payloadPath": "/tmp/jq-payloads/session-123/query-456/payload.json",
  "payloadSchema": {"items": [{"id": "number", "name": "string"}]},
  ...
}

Agents can immediately parse the file:

const data = JSON.parse(fs.readFileSync(payloadPath, 'utf8'));
// Access all actual values from complete response

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • example.com
    • Triggering command: /tmp/go-build291532669/b275/launcher.test /tmp/go-build291532669/b275/launcher.test -test.testlogfile=/tmp/go-build291532669/b275/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true go1.25.6 -c=4 -nolocalimports -importcfg /tmp/go-build291532669/b256/importcfg -pack /opt/hostedtoolcache/go/1.25.6/x64/src/encoding/csv/reader.go rev-�� go ude-agent-sdk/ve--64 /home/REDACTED/.ca-o (dns block)
  • invalid-host-that-does-not-exist-12345.com
    • Triggering command: /tmp/go-build291532669/b260/config.test /tmp/go-build291532669/b260/config.test -test.testlogfile=/tmp/go-build291532669/b260/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true go1.25.6 -c=4 -nolocalimports -importcfg /tmp/go-build291532669/b186/importcfg -pack /opt/hostedtoolcache/go/1.25.6/x64/src/mime/multipart/formdata.go rev-�� go HEAD x_amd64/vet (dns block)
  • nonexistent.local
    • Triggering command: /tmp/go-build291532669/b275/launcher.test /tmp/go-build291532669/b275/launcher.test -test.testlogfile=/tmp/go-build291532669/b275/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true go1.25.6 -c=4 -nolocalimports -importcfg /tmp/go-build291532669/b256/importcfg -pack /opt/hostedtoolcache/go/1.25.6/x64/src/encoding/csv/reader.go rev-�� go ude-agent-sdk/ve--64 /home/REDACTED/.ca-o (dns block)
  • slow.example.com
    • Triggering command: /tmp/go-build291532669/b275/launcher.test /tmp/go-build291532669/b275/launcher.test -test.testlogfile=/tmp/go-build291532669/b275/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true go1.25.6 -c=4 -nolocalimports -importcfg /tmp/go-build291532669/b256/importcfg -pack /opt/hostedtoolcache/go/1.25.6/x64/src/encoding/csv/reader.go rev-�� go ude-agent-sdk/ve--64 /home/REDACTED/.ca-o (dns block)
  • this-host-does-not-exist-12345.com
    • Triggering command: /tmp/go-build291532669/b284/mcp.test /tmp/go-build291532669/b284/mcp.test -test.testlogfile=/tmp/go-build291532669/b284/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true go1.25.6 -c=4 -nolocalimports -importcfg /tmp/go-build291532669/b191/importcfg -pack /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/internal/httpcommon/httpcommon.go rev-�� _.a HEAD .12/x64/bin/as (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

- Updated agentInstructions to explicitly state that payload.json contains the complete original response data in valid JSON format
- Clarified that payloadSchema shows structure/types but NOT actual values
- Added explicit guidance on how to read and parse the JSON file
- Updated AGENTS.md with new section explaining payload.json file structure
- Updated .github/agentics/large-payload-tester.md with detailed response format explanation
- Updated internal/middleware/README.md with code examples for reading payload files

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
@Claude Claude AI changed the title [WIP] Enhance instructions for reading payload.json file Clarify payload.json structure in large payload instructions Feb 11, 2026
@Claude Claude AI requested a review from lpcox February 11, 2026 00:49
@lpcox lpcox marked this pull request as ready for review February 11, 2026 00:49
Copilot AI review requested due to automatic review settings February 11, 2026 00:49
@lpcox lpcox merged commit 128bae4 into main Feb 11, 2026
5 checks passed
@lpcox lpcox deleted the claude/update-payload-instructions branch February 11, 2026 00:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances documentation for large payload handling by clarifying the structure and usage of payload.json files. Previously, agents were discovering the file structure through trial and error; now they have explicit instructions across four documentation locations.

Changes:

  • Updated PayloadTruncatedInstructions constant to explicitly explain that payload.json contains complete original data in valid JSON format, while payloadSchema shows only types
  • Added "Understanding the payload.json File" sections to AGENTS.md and large-payload-tester.md with concrete parsing examples
  • Enhanced internal middleware README with code examples showing how to read payload files in bash/jq, Node.js, and Python

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
internal/middleware/jqschema.go Updated PayloadTruncatedInstructions constant to provide clearer guidance about payload.json structure and usage
internal/middleware/README.md Added "Understanding the response" and "Reading the payload.json file" sections with multi-language code examples
AGENTS.md Added "Understanding the payload.json File" section explaining the distinction between payloadSchema (types) and payload.json (values)
.github/agentics/large-payload-tester.md Added "Understanding the Response Format" section documenting each metadata field

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +79 to +90
```bash
# Using cat and jq
cat /tmp/gh-awmg/tools-calls/a1b2c3d4e5f6.../payload.json | jq .

# Using Node.js
const data = JSON.parse(fs.readFileSync(payloadPath, 'utf8'));

# Using Python
import json
with open(payload_path) as f:
data = json.load(f)
```
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code block mixes three different languages (bash, Node.js, and Python) within a single bash fence. This creates syntax issues since the Node.js and Python code aren't valid bash. Consider either:

  1. Using separate code blocks with appropriate language identifiers (javascript, python), or
  2. Using a generic code fence (```) without a language specifier

Additionally, there's a variable naming inconsistency: line 84 uses payloadPath (camelCase, JavaScript convention) while line 88 uses payload_path (snake_case, Python convention). This inconsistency is actually correct for each language's conventions, but the first issue with the bash fence makes the code block misleading.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants