claude-code - 💡(How to fix) Fix [DOCS] Agent SDK Read tool docs omit size-cap behavior and `parts` output [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52627Fetched 2026-04-24 06:02:04
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×3
RAW_BUFFERClick to expand / collapse

Documentation Type

Missing documentation (feature not documented)

Documentation Location

https://code.claude.com/docs/en/agent-sdk/typescript

Section/Topic

Read tool reference (FileReadInput / FileReadOutput) in the Agent SDK TypeScript and Python references

Current Documentation

The TypeScript reference currently says:

type FileReadInput = { file_path: string; offset?: number; limit?: number; pages?: string; };

Reads files from the local filesystem, including text, images, PDFs, and Jupyter notebooks. Use pages for PDF page ranges (for example, "1-5").

Later on the same page it also says:

type FileReadOutput = ... | { type: "parts"; file: { filePath: string; originalSize: number; count: number; outputDir: string; }; };

Returns file contents in a format appropriate to the file type. Discriminated on the type field.

The Python reference currently documents only:

{ "file_path": str, "offset": int | None, "limit": int | None, }

Output (Text files): { "content": str, "total_lines": int, "lines_returned": int }

Output (Images): { "image": str, "mime_type": str, "file_size": int }

What's Wrong or Missing?

Changelog v2.1.119 includes: Fixed SDK/bridge read_file not correctly enforcing size cap on growing files.

That indicates SDK/bridge read_file / Read calls have a real size-cap behavior that callers can hit, but the current docs never explain:

A. When the size cap applies

The reference does not say that large reads can be capped, or that files growing during a read can still hit that cap.

B. What type: "parts" means in practice

The TypeScript reference exposes a parts variant with originalSize, count, and outputDir, but it does not explain when this variant is returned or how callers should handle it instead of inline content.

C. Python/TypeScript parity

The Python reference omits the corresponding large-file/PDF/alternate-output behavior entirely, so Python SDK users are more likely to assume Read only returns inline text or image payloads.

Suggested Improvement

Add a short note to the Read tool docs that:

  • Read enforces a maximum inline payload size
  • files that exceed that cap can return type: "parts" with outputDir, count, and originalSize instead of a single inline payload
  • this can also matter for files that grow while they are being read
  • offset and limit are the recommended way to page through large text files
  • the Python and TypeScript SDK references should document the same Read inputs and output variants

Impact

Medium - Makes feature difficult to understand

Additional Context

Affected Pages:

PageContext
https://code.claude.com/docs/en/agent-sdk/typescriptRead reference lists a parts output shape but does not explain the size cap or when segmented output is returned
https://platform.claude.com/docs/en/agent-sdk/typescriptSame Agent SDK TypeScript reference gap
https://code.claude.com/docs/en/agent-sdk/pythonPython Read reference omits large-file / alternate-output behavior entirely
https://platform.claude.com/docs/en/agent-sdk/pythonSame Python reference gap

Total scope: 4 pages affected

Source: Changelog v2.1.119

Changelog entry: Fixed SDK/bridge read_file not correctly enforcing size cap on growing files

extent analysis

TL;DR

Add documentation for the Read tool to explain the maximum inline payload size, the type: "parts" output variant, and how to handle large files.

Guidance

  • Update the TypeScript reference to include a note about the maximum inline payload size and when the type: "parts" variant is returned.
  • Add documentation to the Python reference to match the TypeScript reference, including the type: "parts" output variant and large-file behavior.
  • Emphasize the use of offset and limit for paging through large text files.
  • Ensure that both TypeScript and Python SDK references document the same Read inputs and output variants.

Example

No code snippet is necessary, as this issue is focused on documentation improvements.

Notes

The current documentation gap affects four pages across the TypeScript and Python SDK references, making it difficult for users to understand the Read tool's behavior with large files.

Recommendation

Apply a workaround by adding the suggested documentation notes to the affected pages, ensuring that users have a clear understanding of the Read tool's behavior and limitations.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING