Jingle Developers

Agent 工具

声明 Agent 可调用的工具,并提供输入 schema、访问级别、审批和用户可读展示。

Agent tools 让扩展能力可以被 Agent 调用。优秀的工具不是把内部函数暴露给 AI,而是提供清晰的访问级别、输入 schema、审批语义和用户可读展示。

Manifest capability

扩展在 manifest 中声明 AI capability:

aiCapability: {
  id: "notion",
  title: "Notion",
  description: "Notion workspace pages, data sources, tasks, and docs.",
  requiredPreferenceNames: ["accessToken"],
  publicPreferenceNames: ["apiBaseUrl"],
  toolNames: ["searchPages", "getPage", "addToPage"],
  guide: "Use this capability for Notion work only after the user connects Notion."
}
能力状态
工具名称注册预览可用
capability guide 注入 Agent 上下文预览可用
connection status 影响工具可用性预览可用
tool display title / description预览可用
更细的 per-tool permission UI规划中

Tool definition

工具在 main definition 中声明:

字段说明
name工具 ID
description给用户和 Agent 看的能力说明
inputSchema工具输入 schema
accessread、write 或 external
approval写入、外部动作或高风险动作的人类确认
handler真正执行工具的函数

handler 收到宿主解析后的上下文,包括连接状态、公开配置和允许的 secret。工具不应自己猜 token,也不应读取 renderer state。

Access levels

access语义示例
read读取远端或本地数据搜索 Notion 页面、列出 GitHub issue
write修改外部系统创建 GitHub issue、追加 Notion 页面内容
external打开外部应用、网页或产生外部副作用打开 Notion app、触发外部 workflow

Approval

写操作和外部副作用应该让用户在执行前看懂影响。工具定义可以提供 confirmation:标题、风险标签、摘要事实和确认按钮。

approval: {
  required: true,
  buildConfirmation(input) {
    return {
      title: "Create GitHub issue",
      facts: [
        { label: "Repository", value: input.repository },
        { label: "Title", value: input.title }
      ]
    }
  }
}

Provider examples

Provider读工具写工具
GitHubissue、PR、repo、notification、workflow run 查询createIssue
Notionpage、block、data source、database 查询addToPage、createPage、createDatabasePage

连接缺失时,Agent 应提示用户先在 Settings 中连接对应扩展,再继续读取或写入 provider。