Extensions recieve toolArgs as a string rather than an object
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 2.1k
- Fork
- 153
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
### Short summary
_No response_
### Affected version or release
v1.1.10
### Installation context
downloaded from website, windows-x64
### What happened?
Hi devs, thanks for your hard work!
From my ai chat -
In `onPreToolUse` the host delivers `toolArgs` as a JSON-encoded *string*, but the SDK docs (`agent-author.md`, `examples.md`) show object access (`args.command`, `...input.toolArgs`) and the `.d.ts` types expose it as `unknown`/`JsonValue`. This means all documented object-style examples silently return nothing. Either deliver a parsed object or parse/normalize in the SDK and document the contract explicitly.
### Steps to reproduce
My extension requires this in order to function:
function toolTargets(toolName, args) {
if (!args) return [];
// The RPC layer delivers toolArgs as a JSON-encoded string; parse it to
// an object so we can inspect .path/.paths/.pattern.
if (typeof args === "string") {
try {
args = JSON.parse(args);
} catch {
return [];
}
}
### Expected behavior
I think args should be passed as objects, but at a minimum when the ai references the documents and then writes and extension, it should copy something that works correctly.
### Additional context
_No response_
Hướng dẫn đóng góp
Hướng nghiên cứu
Start with the onPreToolUse RPC path and the .d.ts types, then compare the documented contract in agent-author.md and examples.md with the string payload described for v1.1.10. Done means the host or SDK contract and documentation consistently explain and support the usable toolArgs shape, including the documented object-style access.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript
- Lĩnh vực
- api, documentation
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 52/100