Skip to content

Conversation

@tlgimenes
Copy link
Contributor

@tlgimenes tlgimenes commented Jan 5, 2026

Summary by cubic

Fix OpenRouter LLM tool bindings to prevent schema validation errors and unblock streaming and generate calls. We now import z from zod and use minimal schemas as placeholders.

  • Bug Fixes
    • Changed type-only z import to a value import from zod.
    • Replaced STREAM_BINDING/GENERATE_BINDING input schemas with z.object({}).
    • Added a minimal output schema (z.object({})) for the generate tool.

Written for commit d20e64d. Summary will update on new commits.

@tlgimenes tlgimenes merged commit d0a4040 into main Jan 5, 2026
1 of 5 checks passed
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

🚀 Preview Deployments Ready!

Your changes have been deployed to preview environments:

📦 apify

🔗 View Preview

📦 connection-binding

🔗 View Preview

📦 data-for-seo

🔗 View Preview

📦 datajud

🔗 View Preview

📦 db-binding

🔗 View Preview

📦 event-bus

🔗 View Preview

📦 gemini-pro-vision

🔗 View Preview

📦 google-calendar

🔗 View Preview

📦 grain-official

🔗 View Preview

📦 mcp-studio

🔗 View Preview

📦 meta-ads

🔗 View Preview

📦 nanobanana

🔗 View Preview

📦 object-storage

🔗 View Preview

📦 openrouter

🔗 View Preview

📦 perplexity

🔗 View Preview

📦 pinecone

🔗 View Preview

📦 readonly-sql

🔗 View Preview

📦 registry

🔗 View Preview

📦 replicate

🔗 View Preview

📦 sora

🔗 View Preview

📦 template-minimal

🔗 View Preview

📦 veo

🔗 View Preview

📦 whisper

🔗 View Preview

These previews will be automatically updated with new commits to this PR.


Deployed from commit: ea10055

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 1 file

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="openrouter/server/tools/llm-binding.ts">

<violation number="1" location="openrouter/server/tools/llm-binding.ts:480">
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`.</violation>

<violation number="2" location="openrouter/server/tools/llm-binding.ts:515">
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&#39;t be validated against any schema.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

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

"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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants