
Advanced
一个聊天窗口,读你的 CRM、你的文档和你的账单,然后把那件谁都不想开五个标签页去做的跨工具琐事做掉。
Model Context Protocol 把工具访问变成了一个标准。不用为每个服务写一个单独的集成,智能体拿到一份类型化工具的清单,在运行时挑对的那一个。你维护一个连接的注册表、一份按用户角色的权限映射,以及一份智能体做过的每一次调用的日志。
零件
- 表:connections、tool_calls、approvals
- 一个按用户角色列出可用工具的服务器函数
- 带类型化参数和校验的工具路由器
- 任何写动作之前的批准卡片
- 带每次运行成本和延迟的调用日志
怎么赚钱
按坐席卖给同时活在五个工具里的团队,或者作为一次性的按月搭建,卖给一家想要自己内部副驾的公司。
搭建耗时
两个晚上
一步步
- 先定义工具契约:名称、描述、参数 schema,以及这个工具是读还是写。
- 把连接存在一个表里,带上归属用户、服务名和一个令牌引用,绝不在客户端放原始令牌。
- 写一个服务器函数,只返回当前角色可以用的那些工具。
- 让模型挑一个工具,对着 schema 校验参数,把任何不匹配的都拒掉。
- 对写类工具,在执行前渲染一张带确切载荷的批准卡片。
- 把每次调用连同时长、tokens 和结果记下来,然后在界面里显示一条运行时间线。
- 加一个空跑开关,好让一个新连接能在不碰真实数据的情况下被测试。
Build an internal tool-calling agent with a typed tool registry. Data: connections (user_id, service, label, status), tools (name, description, args_schema, mode read or write), tool_calls (tool, args, result, duration_ms, cost), approvals (tool_call_id, status). Server: one function that returns the tools allowed for the current user role, one function that executes a tool after validating arguments against args_schema, and one that records the call. Agent loop: the model receives the allowed tool list, chooses at most one tool per turn, and must explain in one sentence why it chose it. Safety: any tool marked write requires an approval card showing the exact arguments before it runs. Never execute a write tool without a recorded approval row. UI: chat panel, a connections page with a test-run button, and a run timeline showing each tool call with duration and cost. Protect every table with row level security so a user only ever sees their own connections and calls.
#mcp#tools#integrations#ops