diff --git a/frontend/src/lib/components/copilot/chat/flow/FlowAIChat.svelte b/frontend/src/lib/components/copilot/chat/flow/FlowAIChat.svelte index 37db9a90ba..b2496bbcda 100644 --- a/frontend/src/lib/components/copilot/chat/flow/FlowAIChat.svelte +++ b/frontend/src/lib/components/copilot/chat/flow/FlowAIChat.svelte @@ -135,7 +135,8 @@ await acceptPendingFlowEditsIfEnabled() }, getFlowInputsSchema: async () => { - return flowStore.val.schema ?? {} + const s = flowStore.val.schema ?? {} + return { type: 'object', properties: {}, required: [], ...s } }, updateExprsToSet: (id: string, inputTransforms: Record) => { diff --git a/frontend/src/lib/components/copilot/chat/shared.ts b/frontend/src/lib/components/copilot/chat/shared.ts index aecea1ddfc..ddbd7bdb32 100644 --- a/frontend/src/lib/components/copilot/chat/shared.ts +++ b/frontend/src/lib/components/copilot/chat/shared.ts @@ -936,7 +936,9 @@ export async function buildSchemaForTool( throw new Error(`Invalid flow inputs schema: ${invalidProperties.join(', ')}`) } - toolDef.function.parameters = { ...schema, additionalProperties: false } + // Anthropic requires input_schema.type to be present; flows with no inputs + // can produce a sparse schema (e.g. { order: [] }) lacking it. + toolDef.function.parameters = { type: 'object', ...schema, additionalProperties: false } // recursively normalize provider-incompatible schema fragments normalizeToolParameterSchema(toolDef.function.parameters)