Skip to content

fix: rename parameters to inputSchema for AI SDK v5 compatibility - #776

Merged
2witstudios merged 5 commits into
masterfrom
pu/api-sandbox
Mar 13, 2026
Merged

2witstudios merged 5 commits into
masterfrom
pu/api-sandbox

Conversation

@2witstudios

@2witstudios 2witstudios commented Mar 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Renames parameters → inputSchema in the integration tool converter (CoreTool interface + object literal) and MCP tool converter (return type + object literal)
  • AI SDK v5 (ai@5.0.54) renamed this property; using the old name caused streamText() to receive undefined schemas, which AI providers rejected with type: "None" errors
  • Integration tools (GitHub, Slack, etc.) and MCP tools now work correctly again
  • Removes dead desktop MCP tool converter (apps/desktop/src/main/mcp-tool-converter.ts) and its 3 test files — the desktop app never imported this module; MCP tools are serialized to the web server where the web-side converter handles conversion

Test plan

  • packages/lib integration converter tests pass (19/19)
  • Desktop typecheck passes (no more missing module errors)
  • Manual: open a chat with a GitHub integration connected and send a message — no 400 error

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor

    • Renamed tool schema property from "parameters" to "inputSchema" across AI tooling to align naming and API shape.
  • Removal

    • Removed MCP tool conversion and naming utilities, including conversion, validation, and safe-naming features for MCP tools (these capabilities are no longer present).
  • Tests

    • Deleted multiple test suites covering MCP tool conversion, naming, validation, and schema type-safety.

AI SDK v5 renamed the tool schema property from `parameters` to `inputSchema`.
The integration and MCP tool converters still used the old name, causing
`streamText()` to receive `undefined` schemas which AI providers rejected
with `type: "None"` errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Mar 13, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 55fc35bc-523a-4a57-b36e-51695ff9d87f

📥 Commits

Reviewing files that changed from the base of the PR and between 44199df and b9fb793.

📒 Files selected for processing (1)
  • apps/web/src/lib/ai/core/__tests__/integration-tool-resolver.test.ts

📝 Walkthrough

Walkthrough

Renames parameters → inputSchema across AI SDK converter surfaces, updates a test mock to match, and removes the desktop MCP tool converter module plus three related test suites and their helpers (JSON Schema→Zod conversion, name validation, and parsing).

Changes

Cohort / File(s) Summary
Web MCP converter
apps/web/src/lib/ai/core/mcp-tool-converter.ts
Return shape renamed: parameters → inputSchema in convertMCPToolsToAISDKSchemas (signature and toolSchemas assignment updated).
AI SDK integration
packages/lib/src/integrations/converter/ai-sdk.ts
CoreTool interface and conversion output field renamed from parameters → inputSchema; local variable renamed accordingly.
Web tests (mock update)
apps/web/src/lib/ai/core/__tests__/integration-tool-resolver.test.ts
Test fixture updated to use inputSchema instead of parameters for mocked converted tool output.
Desktop: converter removed
apps/desktop/src/main/mcp-tool-converter.ts
Entire MCP tool converter module deleted, including AISDKTool interface, convert/parse/validate/createSafeToolName functions, JSON Schema→Zod helpers, constants, and logging hooks.
Desktop: tests removed
apps/desktop/src/main/__tests__/mcp-tool-converter.test.ts, apps/desktop/src/main/__tests__/mcp-tool-name-validation.test.ts, apps/desktop/src/main/__tests__/mcp-tool-naming-convention.test.ts
Three comprehensive test suites deleted, removing coverage for conversion logic, name validation/sanitization, naming conventions, parsing, and many edge cases.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

  • Epic 3: MCP Integration Refactoring #766 — Matches: removes/renames custom MCP converter and switches parameters → inputSchema, aligning with the epic to remove the custom converter in favor of the SDK integration.

Poem

🐰

I hopped through files with careful paws,
I renamed fields and closed old doors,
The converter left, the schema stays bright,
I twitch my nose and nibble code at night.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: rename parameters to inputSchema for AI SDK v5 compatibility' accurately summarizes the main purpose of the changeset, which is renaming a property to maintain compatibility with AI SDK v5.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pu/api-sandbox
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/lib/src/integrations/converter/ai-sdk.ts (1)

250-264: Consider renaming local variable for clarity.

The local variable parameters (line 250) is assigned to the inputSchema property (line 264). Renaming the local variable to inputSchema would improve readability.

♻️ Suggested rename
       try {
-        const parameters = convertToolSchemaToZod(tool.inputSchema);
+        const inputSchema = convertToolSchemaToZod(tool.inputSchema);

         const override = grant.rateLimitOverride;
         const grantForRequest: ToolGrant = {
@@ -261,7 +261,7 @@

         tools[toolName] = {
           description: `[${connection.provider.name}] ${tool.description}`,
-          inputSchema: parameters,
+          inputSchema,
           execute: async (args: Record<string, unknown>) => {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/lib/src/integrations/converter/ai-sdk.ts` around lines 250 - 264,
Rename the local variable parameters to inputSchema to match its usage and
improve clarity: change the result of convertToolSchemaToZod(tool.inputSchema)
(currently assigned to parameters) to inputSchema and then use that inputSchema
when building the tools[toolName] object (where inputSchema is assigned to the
inputSchema property); ensure any other references in the surrounding scope
(e.g., where parameters is used) are updated accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/lib/src/integrations/converter/ai-sdk.ts`:
- Around line 250-264: Rename the local variable parameters to inputSchema to
match its usage and improve clarity: change the result of
convertToolSchemaToZod(tool.inputSchema) (currently assigned to parameters) to
inputSchema and then use that inputSchema when building the tools[toolName]
object (where inputSchema is assigned to the inputSchema property); ensure any
other references in the surrounding scope (e.g., where parameters is used) are
updated accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 093c6490-e028-4760-93fd-5482c6ad93df

📥 Commits

Reviewing files that changed from the base of the PR and between a859dd4 and 4d37438.

📒 Files selected for processing (2)
  • apps/web/src/lib/ai/core/mcp-tool-converter.ts
  • packages/lib/src/integrations/converter/ai-sdk.ts

2witstudios and others added 3 commits March 13, 2026 12:14
The desktop app never imports this module — MCP tools from the desktop
client are serialized and sent to the web server, where the web-side
converter (apps/web/src/lib/ai/core/mcp-tool-converter.ts) handles
the actual JSON Schema → Zod conversion for AI SDK.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…name local var

- Remove mcp-tool-name-validation.test.ts and mcp-tool-naming-convention.test.ts
  which imported from the deleted mcp-tool-converter.ts (CI typecheck failure)
- Rename local `parameters` variable to `inputSchema` in ai-sdk.ts converter
  for consistency (CodeRabbit review feedback)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@2witstudios

Copy link
Copy Markdown
Owner Author

Addressed review feedback:

  1. CodeRabbit nitpick (local variable rename): Renamed parameters → inputSchema in packages/lib/src/integrations/converter/ai-sdk.ts:250,264 so the local variable matches the property name. Done in commit 44199df.

  2. CI fix: The previous commit deleted apps/desktop/src/main/mcp-tool-converter.ts (dead code — never imported outside its own tests), but two other test files (mcp-tool-name-validation.test.ts, mcp-tool-naming-convention.test.ts) still imported from it. Deleted those too — the functions they tested (validateToolName, createSafeToolName, parseMCPToolName) are covered by the web-side converter and its test suite.

  3. PR description updated to reflect the additional cleanup.

The mock CoreTool object in the test was still using the old `parameters`
property name, causing the web typecheck CI job to fail.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@2witstudios
2witstudios merged commit 398c2b0 into master Mar 13, 2026
3 checks passed
@2witstudios
2witstudios deleted the pu/api-sandbox branch March 14, 2026 23:08
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.

1 participant