[PR #4014] docs: fix math tool example #10840

Closed
opened 2026-02-16 18:15:35 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/4014

State: closed
Merged: Yes


Fixes #4008

Summary

  • Fixes the custom tools documentation example to return strings instead of numbers, resolving validation errors when executing the tools.
  • This error is occurred since tool allows only Promise<string> for its result.

Changes

  • Updated add and multiply tool examples to return string results using .toString()

Test

Screenshot 2025-11-07 at 9 23 32 AM
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/4014 **State:** closed **Merged:** Yes --- Fixes #4008 ## Summary - Fixes the custom tools documentation example to return strings instead of numbers, resolving validation errors when executing the tools. - This error is occurred since `tool` allows only `Promise<string>` for its result. ## Changes - Updated `add` and `multiply` tool examples to return string results using `.toString()` ## Test <img width="249" height="88" alt="Screenshot 2025-11-07 at 9 23 32 AM" src="https://github.com/user-attachments/assets/2fe6b5bf-f9c8-4475-972d-92ad92b5c0a9" />
yindo added the pull-request label 2026-02-16 18:15:35 -05:00
yindo closed this issue 2026-02-16 18:15:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10840