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
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 const isAllowed = (path: string, approval: ToolDefinition["approval"]) =>84 const isAllowed = (path: string, approval: ToolDefinition["approval"]) =>
81 getDecisionForContext(85 getDecisionForContext(
82 { path, approval, description: "", run: async () => null } as ToolDefinition,86 { 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
101 "Search available tools by keyword. Returns preferred path aliases, signature hints, and ready-to-copy call examples. Compact mode is enabled by default.",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 typing: {102 typing: {
103 inputSchema: {103 inputSchema: {
104 type: "object",104 anyOf: [
105 properties: {105 { type: "string" },
106 query: { type: "string" },106 {
107 depth: { type: "number" },107 type: "object",
108 limit: { type: "number" },108 properties: {
109 compact: { type: "boolean" },109 query: { type: "string" },
110 },110 depth: { type: "number" },
111 required: ["query"],111 limit: { type: "number" },
112 compact: { type: "boolean" },
113 },
114 required: ["query"],
115 },
116 ],
112 },117 },
113 outputSchema: {118 outputSchema: {
114 type: "object",119 type: "object",