Extensions recieve toolArgs as a string rather than an object
- Langage dominant
- Aucune donnée de langage
- Étoiles
- 2.1k
- Forks
- 157
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
### 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_
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par le chemin RPC onPreToolUse et les types .d.ts, puis comparez le contrat documenté dans agent-author.md et examples.md avec le payload de type chaîne décrit pour v1.1.10. Le travail est terminé lorsque le contrat de l’hôte ou du SDK et la documentation expliquent et prennent en charge de manière cohérente la forme utilisable de toolArgs, y compris l’accès documenté de style objet.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript
- Domaine
- api, documentation
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- Active
- Clarté
- Plutôt claire
- Accessibilité débutants
- 52/100