|
@@ -86,7 +86,7 @@ func (d Def[T]) Register(s *server.MCPServer) {
|
|
|
mcp.WithInputSchema[T](),
|
|
mcp.WithInputSchema[T](),
|
|
|
mcp.WithTitleAnnotation(d.Title),
|
|
mcp.WithTitleAnnotation(d.Title),
|
|
|
mcp.WithReadOnlyHintAnnotation(d.ReadOnly),
|
|
mcp.WithReadOnlyHintAnnotation(d.ReadOnly),
|
|
|
- mcp.WithDestructiveHintAnnotation(false),
|
|
|
|
|
|
|
+ mcp.WithDestructiveHintAnnotation(d.Destructive), // 覆盖、删除类写操作为 true:自动模式下也每次审批
|
|
|
mcp.WithOpenWorldHintAnnotation(false),
|
|
mcp.WithOpenWorldHintAnnotation(false),
|
|
|
),
|
|
),
|
|
|
mcp.NewTypedToolHandler(func(ctx context.Context, _ mcp.CallToolRequest, args T) (*mcp.CallToolResult, error) {
|
|
mcp.NewTypedToolHandler(func(ctx context.Context, _ mcp.CallToolRequest, args T) (*mcp.CallToolResult, error) {
|
|
@@ -142,7 +142,7 @@ schema 由 mcp-go 依赖的 `google/jsonschema-go` 生成:`jsonschema` 标签
|
|
|
| `List(rows, limit)` | 列表 | `{"total":N,"returned":n,"truncated":bool,"items":[...]}` |
|
|
| `List(rows, limit)` | 列表 | `{"total":N,"returned":n,"truncated":bool,"items":[...]}` |
|
|
|
| `Table(cols, rows, limit)` | 行多、字段固定的数据 | 首行列名的 TSV 文本,比 JSON 省一半以上字符 |
|
|
| `Table(cols, rows, limit)` | 行多、字段固定的数据 | 首行列名的 TSV 文本,比 JSON 省一半以上字符 |
|
|
|
| `Export(name, csv)` | 导出工具(第 5 节) | `EmbeddedResource`(`text/csv`) |
|
|
| `Export(name, csv)` | 导出工具(第 5 节) | `EmbeddedResource`(`text/csv`) |
|
|
|
-| `Fail(err)` / `Upstream(name, err)` | 错误 | `isError` + 一句中文说明 + 处理建议 |
|
|
|
|
|
|
|
+| `Fail(err)` / `Upstream(name, err)` | 错误 | `isError` + 一句中文说明 + 处理建议。`Upstream` 只返回数据源、错误类别与错误编号,原始错误(可能含内部地址、SQL)只写日志 |
|
|
|
|
|
|
|
|
统一限制:单次结果(非导出)不超过 30,000 字符;超过时按行截断并标明 `truncated`,附一句“请缩小范围或使用 xxx_export”。这样不会触发 AgentServer 的 10 万字截断(那条路径会把前 10 万字仍放进上下文)。
|
|
统一限制:单次结果(非导出)不超过 30,000 字符;超过时按行截断并标明 `truncated`,附一句“请缩小范围或使用 xxx_export”。这样不会触发 AgentServer 的 10 万字截断(那条路径会把前 10 万字仍放进上下文)。
|
|
|
|
|
|