Skip to content

fix(wasm): use typed WASM schema as advertised schema when available - #1699

Merged
serrrfirat merged 1 commit into
nearai:stagingfrom
anthhub:fix-wasm-schema
Mar 28, 2026
Merged

serrrfirat merged 1 commit into
nearai:stagingfrom
anthhub:fix-wasm-schema

Conversation

@anthhub

@anthhub anthhub commented Mar 27, 2026

Copy link
Copy Markdown

Summary

When a WASM tool exports a typed schema with properties, use it as the advertised schema instead of always falling back to permissive {}. This lets the LLM see the correct parameter requirements and avoids repeated calls with empty params.

  • In wrapper.rs: WasmToolSchemas::new() now checks if the extracted schema has typed properties and uses it as the advertised schema
  • In loader.rs: updated the misleading "missing parameters" warning to account for WASM-exported schemas

Fixes #1303

Test plan

  • Unit test verifying typed schema propagation
  • cargo check / cargo check --no-default-features --features libsql / cargo check --all-features
  • cargo clippy --all --tests — zero warnings

@github-actions github-actions Bot added scope: tool/wasm WASM tool sandbox size: M 50-199 changed lines risk: medium Business logic, config, or moderate-risk modules contributor: regular 2-5 merged PRs labels Mar 27, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini is experiencing higher than usual traffic and was unable to create the review. Please try again in a few hours by commenting /gemini review.

@zmanian zmanian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approve. Fallback logic is correct: required/enum props -> typed props -> permissive {}. The schema_is_typed_property helper is comprehensive. Good test coverage. Minor suggestion: add a test for mixed typed/untyped properties in the fallback path.

@serrrfirat
serrrfirat merged commit 27e8d6f into nearai:staging Mar 28, 2026
14 checks passed
DougAnderson444 pushed a commit to DougAnderson444/ironclaw that referenced this pull request Mar 29, 2026
drchirag1991 pushed a commit to drchirag1991/ironclaw that referenced this pull request Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: regular 2-5 merged PRs risk: medium Business logic, config, or moderate-risk modules scope: tool/wasm WASM tool sandbox size: M 50-199 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MEDIUM] WASM tools expose permissive {} schemas to the LLM even when the component exports a typed schema

3 participants