Documentation Index
Fetch the complete documentation index at: https://docs.agentfront.dev/llms.txt
Use this file to discover all available pages before exploring further.
Generates a @Provider class with a Symbol token and configurable scope for the DI container.
Usage
nx g @frontmcp/nx:provider database --project crm
nx g @frontmcp/nx:provider database --project crm --scope singleton
Options
| Option | Type | Default | Description |
|---|
name | string | — | Required. The name of the provider |
project | string | — | Required. The project to add the provider to |
scope | singleton | request | context | singleton | The provider scope |
directory | string | — | Subdirectory within src/providers/ |
Generated Code
import { Provider } from '@frontmcp/sdk';
export const DATABASE_TOKEN = Symbol('DatabaseProvider');
@Provider({
token: DATABASE_TOKEN,
scope: 'singleton',
})
export class DatabaseProvider {
// TODO: implement provider logic
static factory(): DatabaseProvider {
return new DatabaseProvider();
}
}
import { DATABASE_TOKEN } from '../providers/database.provider';
@Tool({ name: 'query-db', inputSchema: { sql: z.string() } })
class QueryDbTool extends ToolContext {
async execute({ sql }) {
const db = this.get(DATABASE_TOKEN);
return db.query(sql);
}
}