Extensions recieve toolArgs as a string rather than an object
- Vorherrschende Sprache
- Keine Sprachdaten
- Sterne
- 2.1k
- Forks
- 153
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
### 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_
Beitragsleitfaden
Rechercherichtung
Beginne mit dem onPreToolUse-RPC-Pfad und den .d.ts-Typen und vergleiche anschließend den dokumentierten Vertrag in agent-author.md und examples.md mit dem für v1.1.10 beschriebenen String-Payload. Die Aufgabe ist abgeschlossen, wenn der Host- oder SDK-Vertrag und die Dokumentation die verwendbare toolArgs-Struktur konsistent erklären und unterstützen, einschließlich des dokumentierten objektbasierten Zugriffs.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- api, documentation
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 52/100