github / github/app

Extensions recieve toolArgs as a string rather than an object

未关闭
#3,014 0 条评论 0 个 reaction 已指派 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_

贡献指南

打开贡献指南

调研方向

先从 onPreToolUse RPC 路径和 .d.ts 类型入手,然后将 agent-author.md 和 examples.md 中记录的契约与 v1.1.10 所描述的字符串 payload 进行对比。只有当主机或 SDK 契约和文档能够一致地说明并支持可用的 toolArgs 形态(包括文档所述的对象式访问)时,才算完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
api, documentation
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
52/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。