github / github/app

Extensions recieve toolArgs as a string rather than an object

Abierto
#3,014 0 comentarios 0 reacciones 0 asignados Ver en GitHub
triage
Lenguaje dominante
Sin datos de lenguaje
Estrellas
2.1k
Forks
153
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Empieza por la ruta RPC onPreToolUse y los tipos .d.ts; después compara el contrato documentado en agent-author.md y examples.md con el payload de tipo string descrito para v1.1.10. Se considera terminado cuando el contrato del host o del SDK y la documentación explican y admiten de forma coherente la estructura utilizable de toolArgs, incluido el acceso con estilo de objeto documentado.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript
Área
api, documentation
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Activo
Claridad
Bastante claro
Aptitud para principiantes
52/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.