Documentation
¶
Overview ¶
Package toolrun 提供两个产品共用的 MCP 调用支持:一次调用内的诊断 scope、工具注册 包装,以及输入校验失败的统一结果。
包的组成:Scope 与 NewScope 分配调用 ID 并持有日志入口,AddTool 注册工具并 记录失败,ProtectInput 把 SDK 参数的原始诊断换成工具声明的安全结果。逻辑分页的 输入解析与输出字段在 paging.go。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTool ¶
func AddTool[In, Out any](scope *Scope, server *mcp.Server, tool *mcp.Tool, handler mcp.ToolHandlerFor[In, Out])
AddTool 注册工具,并为每次调用附上调用上下文与不含凭据的诊断。SDK 参数拒绝时保留 固定文案的结果布局;handler 的结果与错误原样交给 MCP SDK。
func ParseListPlan ¶
func ParseListPlan(input ListIn) (pagination.PagePlan, error)
ParseListPlan 在开始 SDK 工作前校验外部输入;分页语义由 internal/pagination 拥有。
func ProtectInput ¶
func ProtectInput(server *mcp.Server, name string, failure func() *mcp.CallToolResult)
ProtectInput 在 typed handler 执行前拦截 SDK 的参数校验诊断,换成 failure 给出的安全 结果;handler 已经执行时不动其结果。