Unified · Split
| @@ -76,7 +76,11 @@ export async function invokeTool(ctx: ActionCtx, task: TaskRecord, call: ToolCal · 75 unmodified lines | ||
| 76 | 76 | ); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | − const payload = input && typeof input === "object" ? (input as Record<string, unknown>) : {}; | |
| 79 | + const payload = (input && typeof input === "object" && !Array.isArray(input)) | |
| 80 | + ? (input as Record<string, unknown>) | |
| 81 | + : (typeof input === "string") | |
| 82 | + ? ({ query: input } satisfies Record<string, unknown>) | |
| 83 | + : {}; | |
| 80 | 84 | const isAllowed = (path: string, approval: ToolDefinition["approval"]) => |
| 81 | 85 | getDecisionForContext( |
| 82 | 86 | { path, approval, description: "", run: async () => null } as ToolDefinition, |
| @@ -101,14 +101,19 @@ baseTools.set("discover", { · 100 unmodified lines | ||
| 101 | 101 | "Search available tools by keyword. Returns preferred path aliases, signature hints, and ready-to-copy call examples. Compact mode is enabled by default.", |
| 102 | 102 | typing: { |
| 103 | 103 | inputSchema: { |
| 104 | − type: "object", | |
| 105 | − properties: { | |
| 106 | − query: { type: "string" }, | |
| 107 | − depth: { type: "number" }, | |
| 108 | − limit: { type: "number" }, | |
| 109 | − compact: { type: "boolean" }, | |
| 110 | − }, | |
| 111 | − required: ["query"], | |
| 104 | + anyOf: [ | |
| 105 | + { type: "string" }, | |
| 106 | + { | |
| 107 | + type: "object", | |
| 108 | + properties: { | |
| 109 | + query: { type: "string" }, | |
| 110 | + depth: { type: "number" }, | |
| 111 | + limit: { type: "number" }, | |
| 112 | + compact: { type: "boolean" }, | |
| 113 | + }, | |
| 114 | + required: ["query"], | |
| 115 | + }, | |
| 116 | + ], | |
| 112 | 117 | }, |
| 113 | 118 | outputSchema: { |
| 114 | 119 | type: "object", |