Skip to content

Quote MCP paths that hold control characters - #40

Merged
lydakis merged 3 commits into
mainfrom
claude/project-thread-0uzqlk
Oct 18, 2026
Merged

lydakis merged 3 commits into
mainfrom
claude/project-thread-0uzqlk

Conversation

@lydakis

@lydakis lydakis commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Requested by George · project thread

Before: a file named odd\nname.txt (with a real newline) showed up in list, glob, grep and changes as two lines, so the agent couldn't tell what the path was.

After: a path holding any control character is shown as a quoted JSON string ("/d/odd\nname.txt"), which is also exactly what the agent passes back as a tool argument. Ordinary paths are unchanged. The initialize instructions say so in one sentence.

How: one helper, shown(), in crates/sandfs-mcp/src/tools.rs, applied where those four tools and the instructions render a path. No core or API changes. Closes #31.

This change was made by dogfooding: the edit, cargo fmt, tests and clippy all ran inside a sandfs fork of this checkout mounted over FUSE, and sandfs changes listed the two files that were copied back for the commit.

Tests: cargo test -p sandfs-mcp (new test paths_with_control_characters_are_shown_quoted).


Generated by Claude Code

A newline in a file name split one path over two lines of list, glob,
grep and changes output. Those paths are now shown as quoted JSON
strings, which is also how the agent passes them back. Closes #31.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011Sm13qU55Kobe2fHFiLN22
@lydakis lydakis self-assigned this Oct 18, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T23:49:05.211014Z c753b65 New commits
🔒 Security Review ✅ Completed 2026-10-18T23:53:05.433191Z c753b65 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d411f7412d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Addresses the Codex review on #40: the trailing slash of a directory now
sits inside the quotes, the 'nothing found' replies quote their path, and
controls outside ASCII (such as U+0085) are escaped as \uXXXX, which
serde_json leaves raw.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011Sm13qU55Kobe2fHFiLN22

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 17480a6734

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Addresses the second Codex round on #40: U+2028 and U+2029 break lines
in Unicode-aware renderers, and a name starting with " could pass for
another name's quoted form.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011Sm13qU55Kobe2fHFiLN22
@lydakis
lydakis merged commit d803823 into main Oct 18, 2026
14 checks passed
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.

sandfs-mcp: escape control characters in rendered paths

2 participants