History

Allow discover shorthand string queries

Rhys Sullivan committed 8 months ago

Commit 390357e1 parent 5ecb1f62 files · +18 −9Browse files

Unified · Split

2 files
  1. executor/packages/convex/runtime/tool_invocation.ts +5 −1
  2. executor/packages/convex/runtime/workspace_tools.ts +13 −8
executor/packages/convex/runtime/tool_invocation.ts+5−1
@@ -76,7 +76,11 @@ export async function invokeTool(ctx: ActionCtx, task: TaskRecord, call: ToolCal · 75 unmodified lines
7676 );
7777 }
7878
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+ : {};
8084 const isAllowed = (path: string, approval: ToolDefinition["approval"]) =>
8185 getDecisionForContext(
8286 { path, approval, description: "", run: async () => null } as ToolDefinition,
executor/packages/convex/runtime/workspace_tools.ts+13−8
@@ -101,14 +101,19 @@ baseTools.set("discover", { · 100 unmodified lines
101101 "Search available tools by keyword. Returns preferred path aliases, signature hints, and ready-to-copy call examples. Compact mode is enabled by default.",
102102 typing: {
103103 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+ ],
112117 },
113118 outputSchema: {
114119 type: "object",