Skip to content

Fix TypeScript type assertion for MCP tools#8

Merged
chloeilabs merged 2 commits into
mainfrom
claude/clever-rubin-1Drp9
Apr 17, 2026
Merged

Fix TypeScript type assertion for MCP tools#8
chloeilabs merged 2 commits into
mainfrom
claude/clever-rubin-1Drp9

Conversation

@chloeilabs
Copy link
Copy Markdown
Owner

@chloeilabs chloeilabs commented Apr 17, 2026

Summary

This PR fixes a TypeScript type error in the MCP tools initialization by adding an explicit type assertion for the discovered tools.

Changes

  • Added type assertion as ToolSet to the discoveredTools parameter in wrapToolsWithUsageTracking() call in src/lib/server/llm/ai-sdk-fmp-mcp-tools.ts
  • Updated dependencies to latest patch versions across the project (Next.js, React, PostCSS, Prettier, TypeScript ESLint, and Vitest)

Details

The discoveredTools object returned from client.tools() needed an explicit ToolSet type assertion to satisfy TypeScript's type checking. This ensures type safety when passing the tools to the wrapToolsWithUsageTracking() function.

https://claude.ai/code/session_01R24hBDBmbRR6LqeRqQesjp

Summary by CodeRabbit

  • Chores
    • Updated npm package dependencies to latest versions, including Next.js 16.2.4, React 19.2.5, and development tools (TypeScript ESLint, Prettier, PostCSS, Vitest).
    • Fixed type casting in AI SDK integration for improved type safety.

claude added 2 commits April 17, 2026 05:25
Patches `next` 16.2.2 → 16.2.4 (resolves GHSA-q4gf-8mx6-v5v3 DoS), pulls
`vite` ≥8.0.5 via vitest (clears two high-severity advisories) and
`picomatch` ≥4.0.4 via typescript-eslint (clears two high-severity
extglob ReDoS advisories). Also bumps react/react-dom, postcss, prettier,
kysely, @ai-sdk/mcp, and @next/eslint-plugin-next within their semver
ranges.

Tests (355) and lint pass. Typecheck/build fail on a pre-existing error
in src/lib/server/llm/ai-sdk-fmp-mcp-tools.ts:234 that reproduces against
the unmodified baseline — not introduced by these bumps.

https://claude.ai/code/session_01R24hBDBmbRR6LqeRqQesjp
The FlexibleSchema generic in @ai-sdk/mcp's discovered-tools record
doesn't structurally match the ai package's ToolSet, even though both
shapes are runtime-compatible. Cast at the boundary so wrapToolsWith\
UsageTracking accepts it without restoring the previous typecheck/build
failure.

https://claude.ai/code/session_01R24hBDBmbRR6LqeRqQesjp
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
finance Ready Ready Preview, Comment Apr 17, 2026 5:29am

Request Review

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 17, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c570de39-9743-4280-90d2-1c5328d50416

📥 Commits

Reviewing files that changed from the base of the PR and between ecd3120 and 1fed449.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • package.json
  • src/lib/server/llm/ai-sdk-fmp-mcp-tools.ts

📝 Walkthrough

Walkthrough

Dependency version updates across multiple npm packages including @ai-sdk/mcp, Next.js, React, and development tools. Additionally, a type cast to ToolSet was added in the MCP session creation function for type safety.

Changes

Cohort / File(s) Summary
Dependency Updates
package.json
Bumped versions for @ai-sdk/mcp (^1.0.32→^1.0.36), kysely (^0.28.15→^0.28.16), Next.js (16.2.2→16.2.4), React/React-DOM (^19.2.4→^19.2.5), and various dev tools including ESLint, PostCSS, Prettier, TypeScript-ESLint, and Vitest.
Type Assertion
src/lib/server/llm/ai-sdk-fmp-mcp-tools.ts
Added explicit ToolSet type cast to discoveredTools parameter passed to wrapToolsWithUsageTracking() function.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 Dependencies dance, versions leap and bound,
Next and React skip along without a sound,
A little type-cast, snug and tight,
Makes the MCP tools shine so bright!
✨ All safe and sound!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/clever-rubin-1Drp9

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

@chloeilabs chloeilabs merged commit c3d7282 into main Apr 17, 2026
5 of 6 checks passed
@chloeilabs chloeilabs deleted the claude/clever-rubin-1Drp9 branch April 17, 2026 05:29
chloeilabs added a commit that referenced this pull request Apr 17, 2026
Fix TypeScript type assertion for MCP tools
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