Skip to content

fix(hono): align handlerParams tools with fastify and express adapters#15635

Merged
abhiaiyer91 merged 5 commits into
mastra-ai:mainfrom
Akash504-ai:fix/hono-tools-handlerparams
Apr 22, 2026
Merged

fix(hono): align handlerParams tools with fastify and express adapters#15635
abhiaiyer91 merged 5 commits into
mastra-ai:mainfrom
Akash504-ai:fix/hono-tools-handlerparams

Conversation

@Akash504-ai

@Akash504-ai Akash504-ai commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Description

Expose tools in Hono adapter handlerParams to align with Fastify and Express adapters. Fixes inconsistency where tools was missing in Hono.

Related Issue(s)

N/A

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Checklist

  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works
  • I have addressed all Coderabbit comments on this PR

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 tools in handler parameters was silently overwriting tools fields in request bodies for endpoints like POST /stored/agents and POST /stored/workspaces.

Changes

Fastify Adapter (server-adapters/fastify/src/index.ts)

  • Module augmentation: Renamed the FastifyRequest property from tools: ToolsInput to registeredTools: ToolsInput to avoid conflicts with request body fields
  • Context middleware: Updated to populate request.registeredTools instead of request.tools
  • Handler parameters: Modified route handler parameter mapping to pass registeredTools: request.registeredTools instead of tools: request.tools

Changeset Documentation

  • Added .changeset/fix-fastify-registered-tools.md documenting the patch-level fix for @mastra/fastify
  • Documents that registered tools are now exposed via registeredTools parameter, aligning with Express and Hono adapter contracts

Alignment

The change aligns the Fastify adapter's handler contract with the Express and Hono adapters, which already use registeredTools to prevent request body field collisions.

@vercel

vercel Bot commented Apr 22, 2026

Copy link
Copy Markdown

@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-bot

changeset-bot Bot commented Apr 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: eb12b1e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@mastra/fastify Patch

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

@dane-ai-mastra

Copy link
Copy Markdown
Contributor

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 Fixes #1234).

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 @coderabbitai review in case you want to trigger a review.

@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ba894b63-e49e-4f9d-8d6d-bcb0663a2f80

📥 Commits

Reviewing files that changed from the base of the PR and between 6fdb561 and eb12b1e.

📒 Files selected for processing (1)
  • .changeset/fix-fastify-registered-tools.md
✅ Files skipped from review due to trivial changes (1)
  • .changeset/fix-fastify-registered-tools.md

Walkthrough

Renames the Fastify adapter's request-scoped property from tools to registeredTools in both the type declaration and middleware logic to align with the Express and Hono adapters' handler contract.

Changes

Cohort / File(s) Summary
Fastify adapter implementation
server-adapters/fastify/src/index.ts
Updated FastifyRequest type augmentation to rename tools: ToolsInput to registeredTools: ToolsInput. Modified request context middleware to populate request.registeredTools from this.tools instead of request.tools, and updated handler parameter mapping to pass registeredTools: request.registeredTools.
Changesets documentation
.changeset/fix-fastify-registered-tools.md
Added patch release note documenting that the Fastify adapter now provides registered tools via the registeredTools parameter instead of tools to achieve consistency with Express and Hono adapters.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title mentions 'hono' but the actual changes are entirely in the Fastify adapter, not Hono. The changes rename the Fastify request field from 'tools' to 'registeredTools' to avoid collisions, which contradicts the title's claim of aligning tools with other adapters. Update the PR title to accurately reflect that this is a Fastify fix that renames 'tools' to 'registeredTools', such as: 'fix(fastify): rename request tools field to registeredTools to avoid collisions'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 01a7d51 and a08138f.

📒 Files selected for processing (2)
  • .changeset/fix-hono-tools.md
  • server-adapters/hono/src/index.ts

Comment thread .changeset/fix-hono-tools.md Outdated
@abhiaiyer91

Copy link
Copy Markdown
Member

Fastify should actually do registeredTools, i will take over this PR

@Akash504-ai

Copy link
Copy Markdown
Contributor Author

Got it, thanks for taking a look! Happy to adjust if needed.

abhiaiyer91 and others added 2 commits April 22, 2026 13:31
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>
@abhiaiyer91 abhiaiyer91 merged commit 7b0e024 into mastra-ai:main Apr 22, 2026
11 of 15 checks passed
abhiaiyer91 pushed a commit that referenced this pull request Apr 22, 2026
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>
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