For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/genui/openui/core/interfaces/ToolProvider.md.
Lynx
  • 简体中文
  • 接口: ToolProvider

    用于 Query() 和 Mutation() 工具调用的 ToolProvider 接口。与框架无关,可用于 MCP、REST、GraphQL 或任何后端。

    示例

    // Function map (Renderer normalizes this automatically)
    <Renderer toolProvider={{
      get_users: (args) => fetch(`/api/users`).then(r => r.json()),
    }} />
    
    // MCP client (Renderer wraps extractToolResult automatically)
    <Renderer toolProvider={mcpClient} />

    方法

    callTool()

    callTool(toolName: string, args: Record<string, unknown>): Promise<unknown>

    参数

    参数类型
    toolNamestring
    argsRecord<string, unknown>

    返回

    Promise<unknown>

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。