fix(hono): align handlerParams tools with fastify and express adapters#15635
Conversation
|
@Akash504-ai is attempting to deploy a commit to the Mastra Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: eb12b1e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thank you for your contribution! Please ensure that your PR fixes an existing issue and that you have linked it in the description (e.g. with We use CodeRabbit for automated code reviews. Please address all feedback from CodeRabbit by either making changes to your PR or leaving a comment explaining why you disagree with the feedback. Since CodeRabbit is an AI, it may occasionally provide incorrect feedback. Addressing CodeRabbit's feedback will greatly increase the chances of your PR being merged. We appreciate your understanding and cooperation in helping us maintain high code quality standards. Comment |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughRenames the Fastify adapter's request-scoped property from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/fix-hono-tools.md:
- Line 5: Edit the .changeset/fix-hono-tools.md changeset to scope the
description to the Hono adapter only: remove or reword any claim that this
change aligns with Express or Fastify (the diff text mentioning `tools` and
`registeredTools`), ensure the frontmatter packages list includes only the Hono
package(s), and update the body to state that Hono now exposes `tools` in
handler params (no Express/Fastify references) so the changeset only applies to
the Hono outcome.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c0ae33ea-a8b0-4f3f-bd4c-5b7627e1fd25
📒 Files selected for processing (2)
.changeset/fix-hono-tools.mdserver-adapters/hono/src/index.ts
|
Fastify should actually do |
|
Got it, thanks for taking a look! Happy to adjust if needed. |
Express and Hono adapters expose `registeredTools` in handlerParams, and core handlers in @mastra/server destructure `registeredTools`. Fastify was the outlier using `tools`, which also collided with request-body fields named `tools` (e.g. POST /stored/agents, POST /stored/workspaces), silently overwriting user-supplied tool definitions. Align Fastify with the other adapters and drop the latent collision. Co-Authored-By: Mastra Code (anthropic/claude-opus-4-7) <noreply@mastra.ai>
Co-Authored-By: Mastra Code (anthropic/claude-opus-4-7) <noreply@mastra.ai>
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ # Releases ## @mastra/browser-viewer@0.1.0-alpha.0 ### Minor Changes - Initial release of @mastra/browser-viewer ([#15415](#15415)) Playwright-based browser viewer for CLI providers that enables screencast visualization in Studio. Supports thread-isolated browser sessions and automatic CDP connection management. ```typescript import { BrowserViewer } from '@mastra/browser-viewer'; const workspace = new Workspace({ sandbox: new LocalSandbox({ cwd: './workspace' }), browser: new BrowserViewer({ cli: 'agent-browser', headless: false, }), }); ``` ### Patch Changes - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51)]: - @mastra/core@1.27.0-alpha.1 ## @mastra/core@1.27.0-alpha.1 ### Minor Changes - Added support for CLI-driven browser automation with screencast support in `@mastra/core`, including automatic CDP injection for browser CLIs. ([#15415](#15415)) Fixed local process spawning so workspace-relative `cwd` values no longer get duplicated. ### Patch Changes - Added opt-in temporal-gap markers for observational memory. When enabled via `observationalMemory.temporalMarkers: true`, the agent receives a `<system-reminder type="temporal-gap">` before any user message that arrives more than 10 minutes after the previous one, so it can anchor responses in real elapsed time. Markers are persisted, surfaced to the observer, and rendered by the MastraCode TUI on reload. ([#15605](#15605)) ## @mastra/memory@1.17.0-alpha.0 ### Minor Changes - Added opt-in temporal-gap markers for observational memory. When enabled via `observationalMemory.temporalMarkers: true`, the agent receives a `<system-reminder type="temporal-gap">` before any user message that arrives more than 10 minutes after the previous one, so it can anchor responses in real elapsed time. Markers are persisted, surfaced to the observer, and rendered by the MastraCode TUI on reload. ([#15605](#15605)) ### Patch Changes - Fixed observer agent truncation that could cut UTF-16 surrogate pairs in half when formatting messages, tool results, or observation lines with emoji or other astral-plane characters. This produced lone surrogates that strict JSON parsers (including Anthropic's) reject with errors like `no low surrogate in string`, causing observer runs to fail. ([#15634](#15634)) - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51)]: - @mastra/core@1.27.0-alpha.1 ## @mastra/client-js@1.14.1-alpha.1 ### Patch Changes - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51)]: - @mastra/core@1.27.0-alpha.1 ## @mastra/react@0.2.28-alpha.1 ### Patch Changes - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51)]: - @mastra/core@1.27.0-alpha.1 - @mastra/client-js@1.14.1-alpha.1 ## @mastra/deployer-cloud@1.27.0-alpha.1 ### Patch Changes - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51)]: - @mastra/core@1.27.0-alpha.1 - @mastra/deployer@1.27.0-alpha.1 ## @mastra/deployer-cloudflare@1.1.25-alpha.1 ### Patch Changes - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51)]: - @mastra/core@1.27.0-alpha.1 - @mastra/deployer@1.27.0-alpha.1 ## @mastra/deployer-netlify@1.1.1-alpha.1 ### Patch Changes - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51)]: - @mastra/core@1.27.0-alpha.1 - @mastra/deployer@1.27.0-alpha.1 ## @mastra/deployer-vercel@1.1.19-alpha.1 ### Patch Changes - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51)]: - @mastra/core@1.27.0-alpha.1 - @mastra/deployer@1.27.0-alpha.1 ## @mastra/longmemeval@1.0.30-alpha.1 ### Patch Changes - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51), [`6e9ab07`](6e9ab07)]: - @mastra/core@1.27.0-alpha.1 - @mastra/memory@1.17.0-alpha.0 ## @mastra/opencode@0.0.27-alpha.1 ### Patch Changes - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51), [`6e9ab07`](6e9ab07)]: - @mastra/core@1.27.0-alpha.1 - @mastra/memory@1.17.0-alpha.0 ## @mastra/tavily@1.0.1-alpha.0 ### Patch Changes - Fixed runtime `ERR_MODULE_NOT_FOUND` for `@tavily/core` by making it a direct dependency. Consumers no longer need to install `@tavily/core` manually. ([#15628](#15628)) - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51)]: - @mastra/core@1.27.0-alpha.1 ## mastracode@0.15.1-alpha.1 ### Patch Changes - Added opt-in temporal-gap markers for observational memory. When enabled via `observationalMemory.temporalMarkers: true`, the agent receives a `<system-reminder type="temporal-gap">` before any user message that arrives more than 10 minutes after the previous one, so it can anchor responses in real elapsed time. Markers are persisted, surfaced to the observer, and rendered by the MastraCode TUI on reload. ([#15605](#15605)) - Improved model ID display in the Mastra Code TUI status line. Fireworks model IDs are now shown in compact form (e.g. fireworks/kimi-k2.6 instead of the full fireworks-ai/accounts/fireworks/models/... path). Version separators in model names are also normalized (e.g. kimi-k2p6 is displayed as kimi-k2.6). ([#15631](#15631)) - Updated dependencies \[[`0a0aa94`](0a0aa94), [`96f6fb2`](96f6fb2), [`01a7d51`](01a7d51), [`6e9ab07`](6e9ab07)]: - @mastra/core@1.27.0-alpha.1 - @mastra/tavily@1.0.1-alpha.0 - @mastra/memory@1.17.0-alpha.0 ## @mastra/agent-builder@1.0.28-alpha.1 ### Patch Changes - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51), [`6e9ab07`](6e9ab07)]: - @mastra/core@1.27.0-alpha.1 - @mastra/memory@1.17.0-alpha.0 ## mastra@1.6.2-alpha.1 ### Patch Changes - Improved server deploy errors: the CLI now shows the platform API message (for example billing or payment errors) instead of only a generic status code. ([#15459](#15459)) - Improved env file handling for `mastra server deploy` and `mastra studio deploy`. Deploy now selects a single env file instead of silently merging multiple files. When multiple `.env` files exist, you are prompted to choose one. Added `--env-file` to specify the file directly (e.g. `--env-file .env.staging`), which is required in non-interactive mode when multiple env files are present. ([#15641](#15641)) - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51)]: - @mastra/core@1.27.0-alpha.1 - @mastra/deployer@1.27.0-alpha.1 ## @mastra/deployer@1.27.0-alpha.1 ### Patch Changes - Updated dependencies \[[`2a87046`](2a87046), [`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51), [`0a0aa94`](0a0aa94)]: - @mastra/server@1.27.0-alpha.1 - @mastra/core@1.27.0-alpha.1 ## @mastra/editor@0.7.18-alpha.0 ### Patch Changes - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51), [`6e9ab07`](6e9ab07)]: - @mastra/core@1.27.0-alpha.1 - @mastra/memory@1.17.0-alpha.0 ## @mastra/mcp-docs-server@1.1.27-alpha.2 ### Patch Changes - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51)]: - @mastra/core@1.27.0-alpha.1 ## @mastra/playground-ui@23.0.1-alpha.1 ### Patch Changes - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51)]: - @mastra/core@1.27.0-alpha.1 - @mastra/client-js@1.14.1-alpha.1 - @mastra/react@0.2.28-alpha.1 ## @mastra/server@1.27.0-alpha.1 ### Patch Changes - Forward `requestContext` from the `/approve-tool-call`, `/decline-tool-call`, `/approve-tool-call-generate` and `/decline-tool-call-generate` REST handlers to `agent.approveToolCall(...)` / `declineToolCall(...)` / `approveToolCallGenerate(...)` / `declineToolCallGenerate(...)`. ([#15620](#15620)) Previously `requestContext` was destructured from the handler arguments but never passed through. On resume, `dynamicInstructions` ran with `requestContext: undefined`, so any value placed on the per-request `RequestContext` by upstream middleware (or by `body.requestContext` auto-merge) was lost for the rest of the turn. Agents whose prompt assembly depends on request-scoped data (e.g. read-only state from the frontend) produced blank or placeholder responses after the user approved a HITL tool call. Other agent entry points (`stream`, `generate`) already forwarded `requestContext` correctly; this brings the approval routes in line. - Fixed screencast panel staying "Live" after browser closes due to an error. The `ViewerRegistry` now broadcasts `browser_closed` status when a screencast stream emits an error, not just when it stops cleanly. ([#15415](#15415)) - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51)]: - @mastra/core@1.27.0-alpha.1 ## @mastra/express@1.3.11-alpha.1 ### Patch Changes - Updated dependencies \[[`2a87046`](2a87046), [`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51), [`0a0aa94`](0a0aa94)]: - @mastra/server@1.27.0-alpha.1 - @mastra/core@1.27.0-alpha.1 ## @mastra/fastify@1.3.11-alpha.1 ### Patch Changes - Fix custom route handlers on the Fastify adapter silently overwriting request-body fields named `tools` (e.g. `POST /stored/agents`, `POST /stored/workspaces`). The adapter now exposes registered tools as `registeredTools` in handler params, matching the Express and Hono adapters and the `@mastra/server` handler contract. ([#15635](#15635)) - Updated dependencies \[[`2a87046`](2a87046), [`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51), [`0a0aa94`](0a0aa94)]: - @mastra/server@1.27.0-alpha.1 - @mastra/core@1.27.0-alpha.1 ## @mastra/hono@1.4.6-alpha.1 ### Patch Changes - Updated dependencies \[[`2a87046`](2a87046), [`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51), [`0a0aa94`](0a0aa94)]: - @mastra/server@1.27.0-alpha.1 - @mastra/core@1.27.0-alpha.1 ## @mastra/koa@1.4.11-alpha.1 ### Patch Changes - Updated dependencies \[[`2a87046`](2a87046), [`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51), [`0a0aa94`](0a0aa94)]: - @mastra/server@1.27.0-alpha.1 - @mastra/core@1.27.0-alpha.1 ## @mastra/clickhouse@1.5.1-alpha.1 ### Patch Changes - Improved ClickHouse v-next observability initialization errors to include the underlying ClickHouse message in the standard error text. This makes init failures actionable in loggers that only print `error.message`. ([#15588](#15588)) - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51)]: - @mastra/core@1.27.0-alpha.1 ## create-mastra@1.6.2-alpha.1 ## @internal/playground@1.6.2-alpha.1 ### Patch Changes - Updated dependencies \[[`0a0aa94`](0a0aa94), [`01a7d51`](01a7d51)]: - @mastra/core@1.27.0-alpha.1 - @mastra/client-js@1.14.1-alpha.1 - @mastra/ai-sdk@1.4.1 - @mastra/react@0.2.28-alpha.1 - @mastra/playground-ui@23.0.1-alpha.1 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Description
Expose
toolsin Hono adapter handlerParams to align with Fastify and Express adapters. Fixes inconsistency wheretoolswas missing in Hono.Related Issue(s)
N/A
Type of Change
Checklist
ELI5 (Explain Like I'm 5)
Imagine you have a toolbox that stores tools you can use later. The problem was that if someone gave you a request with a field also called "tools" in it, the two would get mixed up and cause problems. The fix is to call the stored tools "registeredTools" instead so there's no confusion.
Overview
This PR fixes a naming collision in the Fastify adapter where exposing registered tools as
toolsin handler parameters was silently overwritingtoolsfields in request bodies for endpoints likePOST /stored/agentsandPOST /stored/workspaces.Changes
Fastify Adapter (
server-adapters/fastify/src/index.ts)FastifyRequestproperty fromtools: ToolsInputtoregisteredTools: ToolsInputto avoid conflicts with request body fieldsrequest.registeredToolsinstead ofrequest.toolsregisteredTools: request.registeredToolsinstead oftools: request.toolsChangeset Documentation
.changeset/fix-fastify-registered-tools.mddocumenting the patch-level fix for@mastra/fastifyregisteredToolsparameter, aligning with Express and Hono adapter contractsAlignment
The change aligns the Fastify adapter's handler contract with the Express and Hono adapters, which already use
registeredToolsto prevent request body field collisions.