Skip to content

fix: derive execute() input/output types from schemas in tool template#428

Merged
frontegg-david merged 7 commits into
mainfrom
fix/405-create-tool-inferred-types
May 24, 2026
Merged

fix: derive execute() input/output types from schemas in tool template#428
frontegg-david merged 7 commits into
mainfrom
fix/405-create-tool-inferred-types

Conversation

@frontegg-david
Copy link
Copy Markdown
Contributor

@frontegg-david frontegg-david commented May 17, 2026

Summary by CodeRabbit

  • New Features

    • execute() input/output types are now derived from declared schemas, standardizing typing and promoting schema-first patterns.
    • Encourages folder-per-tool or sibling-file layouts for clearer schema/tool separation and re-export patterns.
  • Documentation

    • Updated guides, examples, and reference docs to demonstrate schema-driven type derivation, file layout options, and related patterns.
  • Tests

    • Added/updated tests to assert generated tools emit schema-derived execute() types.
  • Chores

    • .gitignore updated to ignore new lock files.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5e9313d9-96be-42b3-851d-6fa2e2f9f601

📥 Commits

Reviewing files that changed from the base of the PR and between a2157c3 and 13ebce3.

📒 Files selected for processing (1)
  • libs/skills/catalog/frontmcp-development/examples/create-tool/tool-with-di-and-errors.md

📝 Walkthrough

Walkthrough

The PR standardizes FrontMCP tool classes by hoisting inputSchema/outputSchema to module scope and deriving TypeScript input/output types with ToolInputOf<> and ToolOutputOf<>. The generator template, tests, examples, reference docs, and a skills manifest entry were updated to apply the pattern.

Changes

Schema-Derived Typing Pattern Implementation

Layer / File(s) Summary
Generator Template and Test
libs/nx-plugin/src/generators/tool/files/__fileName__.tool.ts__tmpl__, libs/nx-plugin/src/generators/tool/tool.spec.ts
The tool template hoists inputSchema/outputSchema and exports derived ToolInputOf<>/ToolOutputOf<> type aliases. The execute() signature uses those types and returns a Promise. A new generator test (issue #405) verifies the template emits schema-derived types and no longer emits the legacy inline execute input shape.
Example Documentation
libs/skills/catalog/frontmcp-development/examples/create-tool/basic-class-tool.md, .../tool-with-di-and-errors.md, .../tool-with-rate-limiting-and-progress.md
Three examples were refactored to show the schema-first pattern: basic example uses sibling schema/tool files; DI example introduces a folder-per-tool with a schema module and barrel exports; rate-limiting example adds schema snippets and updates execute() signatures to use derived types.
Reference Documentation
libs/skills/catalog/frontmcp-development/references/create-tool.md
The create-tool reference is restructured: class-based examples hoist schemas and derive execute() types, a new "File layout" section documents sibling vs folder-per-tool layouts and index re-exports, and a "Derive execute() types" section explains the pattern and equivalent forms.
Skills Manifest Metadata
libs/skills/catalog/skills-manifest.json
Catalog entries for the three class-based examples were updated to reflect schema-derived typing and updated file-organization guidance.
Misc
.gitignore
Added /.claude/*.lock to .gitignore.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related issues

Poem

🐰 I hoisted schemas high where types can see,

ToolInputOf and ToolOutputOf set them free,
Templates, tests, and docs now sing in line,
Generated tools return shapes crisp and fine,
A joyful hop for tidy types and time.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: deriving execute() input/output types from schemas in the tool template, which is the core modification across the generator template and documentation examples.
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
  • Commit unit tests in branch fix/405-create-tool-inferred-types

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Import BatchProcessTool in the app snippet.

The snippet references BatchProcessTool but 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 win

Add missing GreetUserTool import 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

📥 Commits

Reviewing files that changed from the base of the PR and between 4328981 and a14639f.

📒 Files selected for processing (7)
  • libs/nx-plugin/src/generators/tool/files/__fileName__.tool.ts__tmpl__
  • libs/nx-plugin/src/generators/tool/tool.spec.ts
  • libs/skills/catalog/frontmcp-development/examples/create-tool/basic-class-tool.md
  • libs/skills/catalog/frontmcp-development/examples/create-tool/tool-with-di-and-errors.md
  • libs/skills/catalog/frontmcp-development/examples/create-tool/tool-with-rate-limiting-and-progress.md
  • libs/skills/catalog/frontmcp-development/references/create-tool.md
  • libs/skills/catalog/skills-manifest.json

Comment thread libs/skills/catalog/frontmcp-development/references/create-tool.md Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 17, 2026

Performance Test Results

Status: ✅ All tests passed

Summary

Project Tests Passed Warnings Failed Leaks
✅ demo-e2e-agents 4 4 0 0 0
✅ demo-e2e-cache 11 11 0 0 0
✅ demo-e2e-codecall 4 4 0 0 0
✅ demo-e2e-config 4 4 0 0 0
✅ demo-e2e-direct 3 3 0 0 0
✅ demo-e2e-elicitation 1 1 0 0 0
✅ demo-e2e-errors 4 4 0 0 0
✅ demo-e2e-hooks 3 3 0 0 0
✅ demo-e2e-multiapp 4 4 0 0 0
✅ demo-e2e-notifications 3 3 0 0 0
✅ demo-e2e-openapi 2 2 0 0 0
✅ demo-e2e-providers 4 4 0 0 0
✅ demo-e2e-public 4 4 0 0 0
✅ demo-e2e-redis 15 15 0 0 0
✅ demo-e2e-remember 4 4 0 0 0
✅ demo-e2e-remote 5 5 0 0 0
✅ demo-e2e-serverless 2 2 0 0 0
✅ demo-e2e-skills 15 15 0 0 0
✅ demo-e2e-standalone 2 2 0 0 0
✅ demo-e2e-transport-recreation 3 3 0 0 0
✅ demo-e2e-ui 4 4 0 0 0

Total: 101 tests across 21 projects

📊 View full report in workflow run


Generated at: 2026-05-24T13:16:55.385Z
Commit: c200798d

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
libs/skills/catalog/frontmcp-development/examples/create-tool/tool-with-di-and-errors.md (1)

102-114: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add import or comment for DatabaseProvider.

Line 110 references DatabaseProvider without showing its import. While line 128 notes that the provider implementation is covered in the create-provider reference, adding a brief comment or import statement here would improve example completeness and prevent copy-paste errors.

📝 Suggested fix
 // src/apps/main/index.ts
 import { App } from '`@frontmcp/sdk`';
 
 import { DeleteRecordTool } from './tools/delete-record';
+// DatabaseProvider implementation shown in create-provider reference
 
 `@App`({
   name: 'main',
   providers: [DatabaseProvider],
🤖 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-di-and-errors.md`
around lines 102 - 114, The example references DatabaseProvider in the App
decorator but doesn't show its import; add an import for DatabaseProvider at the
top (or add a one-line comment next to providers: [DatabaseProvider] stating
"see create-provider example for implementation") so consumers copying MainApp
(class MainApp) and the App decorator (App({ providers: [DatabaseProvider],
tools: [DeleteRecordTool] })) won't miss the provider; ensure the import or
comment references the same DatabaseProvider symbol used in the file and keep
DeleteRecordTool and App imports unchanged.
🤖 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.

Outside diff comments:
In
`@libs/skills/catalog/frontmcp-development/examples/create-tool/tool-with-di-and-errors.md`:
- Around line 102-114: The example references DatabaseProvider in the App
decorator but doesn't show its import; add an import for DatabaseProvider at the
top (or add a one-line comment next to providers: [DatabaseProvider] stating
"see create-provider example for implementation") so consumers copying MainApp
(class MainApp) and the App decorator (App({ providers: [DatabaseProvider],
tools: [DeleteRecordTool] })) won't miss the provider; ensure the import or
comment references the same DatabaseProvider symbol used in the file and keep
DeleteRecordTool and App imports unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5147692b-abba-4f84-a078-edd22dc13ff4

📥 Commits

Reviewing files that changed from the base of the PR and between a14639f and 018f28f.

📒 Files selected for processing (2)
  • libs/skills/catalog/frontmcp-development/examples/create-tool/tool-with-di-and-errors.md
  • libs/skills/catalog/frontmcp-development/references/create-tool.md
✅ Files skipped from review due to trivial changes (1)
  • libs/skills/catalog/frontmcp-development/references/create-tool.md

@frontegg-david frontegg-david merged commit c7e187f into main May 24, 2026
3 of 4 checks passed
@frontegg-david frontegg-david deleted the fix/405-create-tool-inferred-types branch May 24, 2026 13:04
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.

create-tool skill: recommend deriving execute() types from schemas + folder-per-tool layout

1 participant