github / github/app

Extensions recieve toolArgs as a string rather than an object

オープン
#3,014 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
triage
主要言語
言語のデータがありません
スター
2.1k
フォーク
153
PR マージ指標
30日以内にマージされた PR はありません

説明

### 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_

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
api, documentation
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
52/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。