fix: derive execute() input/output types from schemas in tool template#428
fix: derive execute() input/output types from schemas in tool template#428frontegg-david wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughThe PR standardizes FrontMCP tool class design by hoisting ChangesSchema-Derived Typing Pattern Implementation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
libs/skills/catalog/frontmcp-development/examples/create-tool/tool-with-rate-limiting-and-progress.md (1)
88-96:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winImport
BatchProcessToolin the app snippet.The snippet references
BatchProcessToolbut does not import it.Suggested fix
// src/apps/main/index.ts import { App } from '`@frontmcp/sdk`'; +import { BatchProcessTool } from './tools/batch-process.tool'; `@App`({ name: 'main', tools: [BatchProcessTool], }) class MainApp {}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@libs/skills/catalog/frontmcp-development/examples/create-tool/tool-with-rate-limiting-and-progress.md` around lines 88 - 96, The snippet uses BatchProcessTool in the App decorator but never imports it; add an import for BatchProcessTool at the top of the file (before the `@App` usage), referencing the module that exports it (the example's BatchProcessTool module or package) and ensure the exported symbol name matches (BatchProcessTool) so MainApp can compile.libs/skills/catalog/frontmcp-development/examples/create-tool/basic-class-tool.md (1)
59-66:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd missing
GreetUserToolimport in app snippet.
tools: [GreetUserTool]is referenced without an import, so the example is not copy-paste runnable.Suggested fix
// src/apps/main/index.ts import { App } from '`@frontmcp/sdk`'; +import { GreetUserTool } from './tools/greet-user.tool'; `@App`({ name: 'main', tools: [GreetUserTool], }) class MainApp {}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@libs/skills/catalog/frontmcp-development/examples/create-tool/basic-class-tool.md` around lines 59 - 66, The example snippet references GreetUserTool but does not import it; update the top of the snippet (where imports are declared) to add an import for GreetUserTool so the code is runnable—e.g., import GreetUserTool from its module alongside the existing App import—ensuring the symbols GreetUserTool, App, and MainApp are all resolved.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@libs/skills/catalog/frontmcp-development/examples/create-tool/tool-with-di-and-errors.md`:
- Around line 22-30: The unlabeled fenced code block showing the project tree
triggers MD040; update the triple-backtick fence in
libs/skills/catalog/frontmcp-development/examples/create-tool/tool-with-di-and-errors.md
to include a language tag (e.g., ```text) so the file-tree block is labeled,
preserving the exact contents between the backticks; this will satisfy the
linter without changing the displayed tree.
In `@libs/skills/catalog/frontmcp-development/references/create-tool.md`:
- Around line 106-111: The markdown examples in create-tool.md are missing
language tags on their directory-tree code fences (triggering MD040); update
both code fences (the block shown at lines ~106-111 and the similar block at
~115-123) to include a language tag such as "text" (e.g., change ``` to ```text)
and apply the suggested content updates (use the alternative expanded tree
sample) so the fenced blocks are properly labeled and the examples match the
repo style.
---
Outside diff comments:
In
`@libs/skills/catalog/frontmcp-development/examples/create-tool/basic-class-tool.md`:
- Around line 59-66: The example snippet references GreetUserTool but does not
import it; update the top of the snippet (where imports are declared) to add an
import for GreetUserTool so the code is runnable—e.g., import GreetUserTool from
its module alongside the existing App import—ensuring the symbols GreetUserTool,
App, and MainApp are all resolved.
In
`@libs/skills/catalog/frontmcp-development/examples/create-tool/tool-with-rate-limiting-and-progress.md`:
- Around line 88-96: The snippet uses BatchProcessTool in the App decorator but
never imports it; add an import for BatchProcessTool at the top of the file
(before the `@App` usage), referencing the module that exports it (the example's
BatchProcessTool module or package) and ensure the exported symbol name matches
(BatchProcessTool) so MainApp can compile.
🪄 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: 6099cd94-13c8-455f-a809-131c37e20ad0
📒 Files selected for processing (7)
libs/nx-plugin/src/generators/tool/files/__fileName__.tool.ts__tmpl__libs/nx-plugin/src/generators/tool/tool.spec.tslibs/skills/catalog/frontmcp-development/examples/create-tool/basic-class-tool.mdlibs/skills/catalog/frontmcp-development/examples/create-tool/tool-with-di-and-errors.mdlibs/skills/catalog/frontmcp-development/examples/create-tool/tool-with-rate-limiting-and-progress.mdlibs/skills/catalog/frontmcp-development/references/create-tool.mdlibs/skills/catalog/skills-manifest.json
| ``` | ||
| src/apps/main/ | ||
| ├── tokens.ts # shared DI tokens | ||
| └── tools/ | ||
| └── delete-record/ | ||
| ├── delete-record.schema.ts # input/output schemas + derived types | ||
| ├── delete-record.tool.ts # @Tool class, execute() | ||
| └── index.ts # barrel re-export | ||
| ``` |
There was a problem hiding this comment.
Add a language tag to the file-tree code fence.
This fence is unlabeled and triggers MD040 (fenced-code-language).
Suggested fix
-```
+```text
src/apps/main/
├── tokens.ts # shared DI tokens
└── tools/
└── delete-record/
├── delete-record.schema.ts # input/output schemas + derived types
├── delete-record.tool.ts # `@Tool` class, execute()
└── index.ts # barrel re-export</details>
<details>
<summary>🧰 Tools</summary>
<details>
<summary>🪛 markdownlint-cli2 (0.22.1)</summary>
[warning] 22-22: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
</details>
</details>
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
@libs/skills/catalog/frontmcp-development/examples/create-tool/tool-with-di-and-errors.md
around lines 22 - 30, The unlabeled fenced code block showing the project tree
triggers MD040; update the triple-backtick fence in
libs/skills/catalog/frontmcp-development/examples/create-tool/tool-with-di-and-errors.md
to include a language tag (e.g., ```text) so the file-tree block is labeled,
preserving the exact contents between the backticks; this will satisfy the
linter without changing the displayed tree.
</details>
<!-- fingerprinting:phantom:triton:hawk -->
<!-- This is an auto-generated comment by CodeRabbit -->
| ``` | ||
| src/apps/<app>/tools/ | ||
| ├── get-weather.tool.ts # @Tool class, execute() | ||
| ├── get-weather.schema.ts # input/output schemas + derived types | ||
| └── get-weather.tool.spec.ts # unit tests | ||
| ``` |
There was a problem hiding this comment.
Label both directory-tree code fences to satisfy markdownlint.
Both fences are missing a language tag and trigger MD040.
Suggested fix
-```
+```text
src/apps/<app>/tools/
├── get-weather.tool.ts # `@Tool` class, execute()
├── get-weather.schema.ts # input/output schemas + derived types
└── get-weather.tool.spec.ts # unit tests- +text
src/apps//tools/
└── get-weather/
├── get-weather.tool.ts # @Tool class, execute()
├── get-weather.schema.ts # input/output schemas + derived types
├── get-weather.tool.spec.ts # unit tests
├── index.ts # barrel re-export
└── … # tool-local helpers, fixtures, error types
Also applies to: 115-123
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 106-106: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@libs/skills/catalog/frontmcp-development/references/create-tool.md` around
lines 106 - 111, The markdown examples in create-tool.md are missing language
tags on their directory-tree code fences (triggering MD040); update both code
fences (the block shown at lines ~106-111 and the similar block at ~115-123) to
include a language tag such as "text" (e.g., change ``` to ```text) and apply
the suggested content updates (use the alternative expanded tree sample) so the
fenced blocks are properly labeled and the examples match the repo style.
Performance Test ResultsStatus: ✅ All tests passed Summary
Total: 101 tests across 21 projects 📊 View full report in workflow run Generated at: 2026-05-17T09:18:18.017Z |
Summary by CodeRabbit
New Features
Documentation