openclaw - ✅(Solved) Fix Thought content tool call format incorrectly parsed as actual invocation causing empty parameter validation errors [1 pull requests, 1 comments, 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
openclaw/openclaw#58868Fetched 2026-04-08 02:31:45
View on GitHub
Comments
1
Participants
1
Timeline
0
Reactions
0

Error Message

  1. Validation error triggered:

Fix Action

Fix / Workaround

Current Workaround

PR fix notes

PR #4767: fix(agents): handle read alias required schema

Description (problem / solution / changelog)

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)
  • Context from dashboard - AGENTS.md (source)
<!-- /greptile_comment -->

Changed files

  • src/agents/pi-tools.read.ts (modified, +12/-5)
RAW_BUFFERClick to expand / collapse

Problem Description

When Agent explains tool usage or shows code examples in the thought content, if it contains format (like ), Gateway incorrectly parses it as an actual tool invocation, passing empty parameters and triggering validation errors.

Reproduction Steps

  1. Agent writes in thought:

  2. Gateway parses it as actual tool invocation:

  3. Validation error triggered:

Affected Tools

  • : missing parameter
  • : missing / parameter
  • : missing parameter
  • : missing parameter
  • All other tools with required parameters

Expected Behavior

Gateway should ONLY parse tool calls from the actual array, ignoring tool format examples in thought content.

Actual Behavior

The format in thought is incorrectly parsed, passing empty parameters and causing validation failures.

Related Links

Environment

  • OpenClaw version: 2026.3.28 (local) / 2026.3.31 (npm latest)
  • Issue status: Still present in 2026.3.31

Proposed Fixes

Option 1: Fix Gateway parsing logic

  • Do not parse tool formats in thought content
  • Only parse actual tool_calls array

Option 2: Merge PR #4767

  • PR #4767 fixes parameter alias compatibility
  • Was closed but not merged, recommend re-review

Current Workaround

Agent avoids writing any tool call format in thought, using natural language descriptions only.

extent analysis

TL;DR

The most likely fix is to modify the Gateway parsing logic to ignore tool formats in thought content and only parse actual tool calls from the tool_calls array.

Guidance

  • Review the Gateway parsing logic to ensure it correctly distinguishes between tool formats in thought content and actual tool invocations.
  • Consider re-reviewing PR #4767, which may provide a fix for parameter alias compatibility issues, although its direct relation to the current problem is unclear.
  • Verify that the parsing logic change does not introduce unintended side effects, such as failing to parse legitimate tool calls.
  • Test the fix with various tool formats and parameters to ensure robustness.

Example

No specific code snippet can be provided without more context, but the parsing logic should be updated to check the source of the tool call (e.g., tool_calls array vs. thought content) before attempting to parse and validate parameters.

Notes

The issue seems to be specific to the Gateway's parsing logic, and fixing this logic is likely to resolve the problem. However, without access to the codebase, it's difficult to provide a precise fix. The proposed fixes and current workaround suggest that the developers are on the right track.

Recommendation

Apply a workaround by modifying the Gateway parsing logic, as this directly addresses the root cause of the issue. This approach allows for a targeted fix without relying on unmerged or potentially unrelated pull requests.

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

openclaw - ✅(Solved) Fix Thought content tool call format incorrectly parsed as actual invocation causing empty parameter validation errors [1 pull requests, 1 comments, 1 participants]