Describe the Bug
AgentConfig.tools accepts an invalid value that should fail type checking. In a static tools map,
each entry should already be a tool object, but TypeScript currently allows a nested resolver
function like myTool: () => realTool.
That compiles without error, even though it is not a valid static tool definition. The bad value
then survives to runtime, where agent.listTools() crashes instead of the mistake being caught by
TypeScript.
Steps To Reproduce
- Clone the reproduction repo: https://github.com/abrahamcl/mastra-bug-agent-tools
Reproduction
npm install
npx tsc --noEmit
Expected: TypeScript reports an error for myTool: () => realTool.
Actual: tsc exits successfully with no type error.
To show that an actual runtime crash occurs when using the invalid config, run:
Link to Minimal Reproducible Example
https://github.com/abrahamcl/mastra-bug-agent-tools
Expected Behavior
Typescript should flag an invalid tool value
Environment Information
System:
OS: macOS 26.3
CPU: (8) arm64 Apple M3
Memory: 128.28 MB / 24.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 25.8.1 - /opt/homebrew/bin/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 11.11.0 - /opt/homebrew/bin/npm
pnpm: 10.32.1 - /opt/homebrew/bin/pnpm
bun: 1.3.10 - /opt/homebrew/bin/bun
Browsers:
Chrome: 146.0.7680.165
Safari: 26.3
npmPackages:
@mastra/core: ^1.24.1 => 1.24.1
@types/node: ^25.5.2 => 25.5.2
mastra: ^1.5.0 => 1.5.0
typescript: ^6.0.2 => 6.0.2
vitest: ^4.1.4 => 4.1.4
zod: ^4.3.6 => 4.3.6
npmGlobalPackages:
@openai/codex: 0.75.0
codex: 0.2.3
httpyac: 6.16.7
mint: 4.2.60
npm: 11.11.0
Verification
Describe the Bug
AgentConfig.tools accepts an invalid value that should fail type checking. In a static tools map,
each entry should already be a tool object, but TypeScript currently allows a nested resolver
function like myTool: () => realTool.
That compiles without error, even though it is not a valid static tool definition. The bad value
then survives to runtime, where agent.listTools() crashes instead of the mistake being caught by
TypeScript.
Steps To Reproduce
Reproduction
Expected: TypeScript reports an error for
myTool: () => realTool.Actual:
tscexits successfully with no type error.To show that an actual runtime crash occurs when using the invalid config, run:
npm run testLink to Minimal Reproducible Example
https://github.com/abrahamcl/mastra-bug-agent-tools
Expected Behavior
Typescript should flag an invalid tool value
Environment Information
Verification