()
| 216 | } |
| 217 | |
| 218 | func (t *TaskTool) InputSchema() map[string]any { |
| 219 | // 构建子代理类型枚举 |
| 220 | subagentTypes := t.middleware.ListSubAgents() |
| 221 | |
| 222 | schema := map[string]any{ |
| 223 | "type": "object", |
| 224 | "properties": map[string]any{ |
| 225 | "description": map[string]any{ |
| 226 | "type": "string", |
| 227 | "description": "Clear, detailed description of the task to delegate", |
| 228 | }, |
| 229 | "subagent_type": map[string]any{ |
| 230 | "type": "string", |
| 231 | "description": fmt.Sprintf("Type of sub-agent to use. Available: %v", subagentTypes), |
| 232 | "enum": subagentTypes, |
| 233 | }, |
| 234 | "context": map[string]any{ |
| 235 | "type": "object", |
| 236 | "description": "Optional context to pass to the sub-agent", |
| 237 | }, |
| 238 | }, |
| 239 | "required": []string{"description", "subagent_type"}, |
| 240 | } |
| 241 | |
| 242 | // 如果启用异步执行,添加 async 参数 |
| 243 | if t.middleware.enableAsync { |
| 244 | schema["properties"].(map[string]any)["async"] = map[string]any{ |
| 245 | "type": "boolean", |
| 246 | "description": "Run asynchronously in background (default: false). If true, returns task_id immediately.", |
| 247 | "default": false, |
| 248 | } |
| 249 | schema["properties"].(map[string]any)["timeout"] = map[string]any{ |
| 250 | "type": "number", |
| 251 | "description": "Timeout in seconds (default: 3600)", |
| 252 | "default": 3600, |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | return schema |
| 257 | } |
| 258 | |
| 259 | func (t *TaskTool) Execute(ctx context.Context, input map[string]any, tc *tools.ToolContext) (any, error) { |
| 260 | description, ok := input["description"].(string) |
nothing calls this directly
no test coverage detected