openclaw - 💡(How to fix) Fix Bug: /v1/responses endpoint client tools not passed to Agent [2 comments, 3 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#52172Fetched 2026-04-08 01:14:48
View on GitHub
Comments
2
Participants
3
Timeline
4
Reactions
0
Author
Timeline (top)
commented ×2closed ×1locked ×1

Root Cause

In src/agents/pi-embedded-runner/run.ts, runEmbeddedPiAgent() calls runEmbeddedAttempt() (~line 929) by individually listing each param field, but omits clientTools. This causes params.clientTools in src/agents/pi-embedded-runner/run/attempt.ts to always be undefined.

The downstream handling code in attempt.ts is fully implemented and correct:

  • Line 1563: const clientTools = toolsEnabled ? params.clientTools : undefined;
  • Lines 1871-1885: toClientToolDefinitions() conversion
  • Line 1887: allCustomTools = [...customTools, ...clientToolDefs] merge into session

But none of this code is ever triggered because the value is never passed through.

Fix Action

Fix

PR: #52171

One line in src/agents/pi-embedded-runner/run.ts:

             images: params.images,
+            clientTools: params.clientTools,
             disableTools: params.disableTools,

Code Example

curl -X POST http://<gateway>:18789/v1/responses \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -H "x-openclaw-agent-id: specialist-planner" \
  -d '{
    "model": "agent:specialist-planner",
    "input": "List your available tools",
    "tools": [{"type":"function","function":{"name":"test_tool","description":"A test tool","parameters":{"type":"object","properties":{}}}}],
    "tool_choice": "auto",
    "stream": false
  }'

---

images: params.images,
+            clientTools: params.clientTools,
             disableTools: params.disableTools,
RAW_BUFFERClick to expand / collapse

Bug Description

When sending requests to the /v1/responses endpoint with a tools field targeting an Agent (model: "agent:..."), the client-provided function tools are silently ignored. The Agent only sees its built-in platform tools (read, write, exec, web_fetch, browser, etc.) and has no knowledge of the client tools.

Reproduction

curl -X POST http://<gateway>:18789/v1/responses \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -H "x-openclaw-agent-id: specialist-planner" \
  -d '{
    "model": "agent:specialist-planner",
    "input": "List your available tools",
    "tools": [{"type":"function","function":{"name":"test_tool","description":"A test tool","parameters":{"type":"object","properties":{}}}}],
    "tool_choice": "auto",
    "stream": false
  }'

Expected: Agent response includes test_tool in its available tools.
Actual: Agent only lists built-in platform tools; test_tool is completely absent.

Root Cause

In src/agents/pi-embedded-runner/run.ts, runEmbeddedPiAgent() calls runEmbeddedAttempt() (~line 929) by individually listing each param field, but omits clientTools. This causes params.clientTools in src/agents/pi-embedded-runner/run/attempt.ts to always be undefined.

The downstream handling code in attempt.ts is fully implemented and correct:

  • Line 1563: const clientTools = toolsEnabled ? params.clientTools : undefined;
  • Lines 1871-1885: toClientToolDefinitions() conversion
  • Line 1887: allCustomTools = [...customTools, ...clientToolDefs] merge into session

But none of this code is ever triggered because the value is never passed through.

Fix

PR: #52171

One line in src/agents/pi-embedded-runner/run.ts:

             images: params.images,
+            clientTools: params.clientTools,
             disableTools: params.disableTools,

extent analysis

Fix Plan

To fix the issue, we need to modify the runEmbeddedPiAgent() function in src/agents/pi-embedded-runner/run.ts to include the clientTools parameter.

  • Update the runEmbeddedPiAgent() function to pass clientTools to runEmbeddedAttempt().
  • Add the following line of code:
             images: params.images,
+            clientTools: params.clientTools,
             disableTools: params.disableTools,

This change ensures that the clientTools are properly passed to the runEmbeddedAttempt() function and subsequently processed by the downstream handling code in attempt.ts.

Verification

To verify the fix, you can:

  • Send a request to the /v1/responses endpoint with a tools field targeting an Agent, similar to the reproduction step.
  • Check the Agent's response to ensure that it includes the client-provided tool (test_tool) in its available tools.

Example Code

The corrected runEmbeddedPiAgent() function call should look like this:

runEmbeddedAttempt({
  // ... other params ...
  images: params.images,
  clientTools: params.clientTools,
  disableTools: params.disableTools,
  // ... other params ...
})

This change should resolve the issue and allow the Agent to recognize and utilize client-provided tools.

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 - 💡(How to fix) Fix Bug: /v1/responses endpoint client tools not passed to Agent [2 comments, 3 participants]