Class: FluentRouter<TContext>
Defined in: packages/core/src/core/builder/FluentRouter.ts:44
Fluent router that shares prefix, description, and middleware across child tools created via .query(), .mutation(), .action().
Type Parameters
| Type Parameter | Description |
|---|---|
TContext | Base application context |
Constructors
Constructor
new FluentRouter<TContext>(prefix): FluentRouter<TContext>;Defined in: packages/core/src/core/builder/FluentRouter.ts:51
Parameters
| Parameter | Type |
|---|---|
prefix | string |
Returns
FluentRouter<TContext>
Methods
action()
action(action): FluentToolBuilder<TContext>;Defined in: packages/core/src/core/builder/FluentRouter.ts:141
Create a neutral action tool under this router's prefix.
Parameters
| Parameter | Type | Description |
|---|---|---|
action | string | Action name (e.g. 'update' → tool name 'prefix.update') |
Returns
FluentToolBuilder<TContext>
A FluentToolBuilder with the prefixed name and inherited config
describe()
describe(text): this;Defined in: packages/core/src/core/builder/FluentRouter.ts:61
Set the shared description for all tools in this router.
Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | Human-readable description |
Returns
this
this for chaining
interactive()
interactive(): this;Defined in: packages/core/src/core/builder/FluentRouter.ts:110
Enable human-in-the-loop interaction for all tools in this router.
All child tools will inherit the .interactive() flag, meaning their handlers can use ask() and ask.redirect() directly.
Returns
this
this for chaining
Example
const admin = f.router('admin')
.use(requireAdmin)
.interactive() // ← all children can use ask()mutation()
mutation(action): FluentToolBuilder<TContext>;Defined in: packages/core/src/core/builder/FluentRouter.ts:131
Create a destructive mutation tool under this router's prefix.
Parameters
| Parameter | Type | Description |
|---|---|---|
action | string | Action name (e.g. 'delete' → tool name 'prefix.delete') |
Returns
FluentToolBuilder<TContext>
A FluentToolBuilder with the prefixed name and inherited config
query()
query(action): FluentToolBuilder<TContext>;Defined in: packages/core/src/core/builder/FluentRouter.ts:121
Create a read-only query tool under this router's prefix.
Parameters
| Parameter | Type | Description |
|---|---|---|
action | string | Action name (e.g. 'list' → tool name 'prefix.list') |
Returns
FluentToolBuilder<TContext>
A FluentToolBuilder with the prefixed name and inherited config
tags()
tags(...tags): this;Defined in: packages/core/src/core/builder/FluentRouter.ts:90
Set capability tags shared by all tools in this router.
Parameters
| Parameter | Type | Description |
|---|---|---|
...tags | string[] | Tag strings for filtering |
Returns
this
this for chaining
use()
Call Signature
use<TDerived>(mw): FluentRouter<TContext & TDerived>;Defined in: packages/core/src/core/builder/FluentRouter.ts:75
Add middleware shared by all tools in this router.
Accepts both MiddlewareDefinition from f.middleware() and raw MiddlewareFn functions.
Type Parameters
| Type Parameter |
|---|
TDerived extends Record<string, unknown> |
Parameters
| Parameter | Type | Description |
|---|---|---|
mw | MiddlewareDefinition<TContext, TDerived> | Middleware function or MiddlewareDefinition |
Returns
FluentRouter<TContext & TDerived>
Router with narrowed TContext type (when using MiddlewareDefinition)
Call Signature
use(mw): this;Defined in: packages/core/src/core/builder/FluentRouter.ts:78
Add middleware shared by all tools in this router.
Accepts both MiddlewareDefinition from f.middleware() and raw MiddlewareFn functions.
Parameters
| Parameter | Type | Description |
|---|---|---|
mw | MiddlewareFn<TContext> | Middleware function or MiddlewareDefinition |
Returns
this
Router with narrowed TContext type (when using MiddlewareDefinition)