MCPcopy Create free account
hub / github.com/astercloud/aster / InputSchema

Method InputSchema

pkg/middleware/subagent.go:218–257  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

216}
217
218func (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
259func (t *TaskTool) Execute(ctx context.Context, input map[string]any, tc *tools.ToolContext) (any, error) {
260 description, ok := input["description"].(string)

Callers

nothing calls this directly

Calls 1

ListSubAgentsMethod · 0.80

Tested by

no test coverage detected