Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions openrouter/server/tools/llm-binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
} from "@decocms/runtime/tools";
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
import { getOpenRouterApiKey } from "server/lib/env.ts";
import type { z } from "zod";
import { z } from "zod";
import { OpenRouterClient } from "../lib/openrouter-client.ts";
import type { Env } from "../main.ts";
import { getBaseUrl } from "./models/utils.ts";
Expand Down Expand Up @@ -476,7 +476,8 @@ export const createLLMStreamTool = (env: Env) =>
description:
"Stream a language model response in real-time using OpenRouter. " +
"Returns a streaming response for interactive chat experiences.",
inputSchema: STREAM_BINDING.inputSchema,
// inputSchema: STREAM_BINDING.inputSchema,
inputSchema: z.object({}),
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Empty input schema removes validation for required properties (modelId, callOptions) that the execute function depends on. This will cause runtime errors when these properties are missing from the context. Consider defining a proper schema that includes the required fields, or using the original STREAM_BINDING.inputSchema.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At openrouter/server/tools/llm-binding.ts, line 480:

<comment>Empty input schema removes validation for required properties (`modelId`, `callOptions`) that the execute function depends on. This will cause runtime errors when these properties are missing from the context. Consider defining a proper schema that includes the required fields, or using the original `STREAM_BINDING.inputSchema`.</comment>

<file context>
@@ -476,7 +476,8 @@ export const createLLMStreamTool = (env: Env) =&gt;
       &quot;Returns a streaming response for interactive chat experiences.&quot;,
-    inputSchema: STREAM_BINDING.inputSchema,
+    // inputSchema: STREAM_BINDING.inputSchema,
+    inputSchema: z.object({}),
     execute: async ({ context }) =&gt; {
       const {
</file context>
Suggested change
inputSchema: z.object({}),
inputSchema: STREAM_BINDING.inputSchema,
Fix with Cubic

execute: async ({ context }) => {
const {
modelId,
Expand Down Expand Up @@ -509,8 +510,9 @@ export const createLLMGenerateTool = (env: Env) =>
description:
"Generate a complete language model response using OpenRouter (non-streaming). " +
"Returns the full response with usage statistics and cost information.",
inputSchema: GENERATE_BINDING.inputSchema,
outputSchema: GENERATE_BINDING.outputSchema,
// inputSchema: GENERATE_BINDING.inputSchema,
inputSchema: z.object({}),
outputSchema: z.object({}),
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Empty output schema removes validation and creates a type mismatch with the return statement which casts to GENERATE_BINDING.outputSchema. The actual runtime output won't be validated against any schema.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At openrouter/server/tools/llm-binding.ts, line 515:

<comment>Empty output schema removes validation and creates a type mismatch with the return statement which casts to `GENERATE_BINDING.outputSchema`. The actual runtime output won&#39;t be validated against any schema.</comment>

<file context>
@@ -509,8 +510,9 @@ export const createLLMGenerateTool = (env: Env) =&gt;
-    outputSchema: GENERATE_BINDING.outputSchema,
+    // inputSchema: GENERATE_BINDING.inputSchema,
+    inputSchema: z.object({}),
+    outputSchema: z.object({}),
     execute: async ({ context }) =&gt; {
       const {
</file context>
Suggested change
outputSchema: z.object({}),
outputSchema: GENERATE_BINDING.outputSchema,
Fix with Cubic

execute: async ({ context }) => {
const {
modelId,
Expand Down
Loading