#4767: fix(agents): handle read alias required schema
agents
Fixed https://github.com/openclaw/openclaw/issues/2596 and tested.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates `patchToolSchemaForClaudeCompatibility` in `src/agents/pi-tools.read.ts` to better handle tools whose JSON schema `required` list contains only the “original” parameter names (`path`/`oldText`/`newText`) after adding Claude-style aliases (`file_path`/`old_string`/`new_string`). Instead of always emitting `required` when non-empty, it now also *removes* the `required` key entirely when the filtered list becomes empty, preventing schemas with an empty `required: []` from being treated as invalid/overly strict by some consumers.
This fits into the tool-wrapper layer that normalizes Claude Code parameter conventions to pi-coding-agent conventions, and patches tool schemas so LLMs trained on Claude Code can call pi tools reliably.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- The change is small and localized to schema-patching logic, preserves existing behavior when `required` remains non-empty, and fixes the specific edge case where an empty `required: []` would otherwise be retained/constructed. No runtime logic outside schema shaping is modified.
- No files require special attention
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#15852: fix: pass agentId when resolving IRC session paths
by MisterGuy420 · 2026-02-14
82.1%
#7382: fix: remove config.schema from agent gateway tool
by kakuteki · 2026-02-02
79.7%
#9339: fix: enhance OpenAI compatibility for tool calling
by 0xrushi · 2026-02-05
78.3%
#11141: Fix JSON schema conversion error when using llama.cpp backend
by 9nix00 · 2026-02-07
78.3%
#11453: fix: apply normalizeToolName() at all tool lookup points
by sypsyp97 · 2026-02-07
77.6%
#3247: [Bug]: Fix session_status tool validation when called with no argum...
by lewiscutey · 2026-01-28
77.6%
#4445: fix: resolve Antigravity "unsupported version" and tool_use schema ...
by harry2690 · 2026-01-30
77.4%
#4922: fix(agents): ensure parallel tool results have correct parentId
by jduartedj · 2026-01-30
77.2%
#7892: Claude/setup agent firewall ww xsv
by starwreckntx · 2026-02-03
76.5%
#8270: fix: support snake_case 'tool_use' in transcript repair (#8264)
by heliosarchitect · 2026-02-03
76.4%