Extensions recieve toolArgs as a string rather than an object
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 2.1k
- Fork
- 153
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
### 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_
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia dal percorso RPC onPreToolUse e dai tipi .d.ts, quindi confronta il contratto documentato in agent-author.md e examples.md con il payload di tipo stringa descritto per v1.1.10. Il lavoro è completo quando il contratto dell’host o dell’SDK e la documentazione spiegano e supportano in modo coerente la struttura utilizzabile di toolArgs, incluso l’accesso documentato in stile oggetto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- api, documentation
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 52/100