Skip to content

feat: add line offsets to memory read MCP#20986

Merged
jif-oai merged 1 commit into
mainfrom
jif/mcp-read-offset
May 4, 2026
Merged

feat: add line offsets to memory read MCP#20986
jif-oai merged 1 commit into
mainfrom
jif/mcp-read-offset

Conversation

@jif-oai

@jif-oai jif-oai commented May 4, 2026

Copy link
Copy Markdown
Collaborator

Why

Memory clients sometimes need to continue reading a file from a known line instead of starting over from the top. Adding a line offset to the read MCP keeps that resume logic simple and avoids re-reading already-consumed content.

What changed

  • Added an optional line_offset argument to the memory read tool, defaulting to 1.
  • Read content starting at the requested 1-indexed line before token truncation, and return start_line_number in the response.
  • Treat invalid offsets as invalid params errors and cover the new behavior in codex-rs/memories/mcp/src/local_tests.rs.

Testing

  • Added unit tests for reading from a non-default starting line.
  • Added unit tests for rejecting 0 and past-end line offsets.

@jif-oai jif-oai changed the title feat: add offset to memory read MCP feat: add line offsets to memory read MCP May 4, 2026
@jif-oai jif-oai merged commit 019755d into main May 4, 2026
26 checks passed
@jif-oai jif-oai deleted the jif/mcp-read-offset branch May 4, 2026 12:26
@github-actions github-actions Bot locked and limited conversation to collaborators May 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant