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.
Decorator Categories
Server Decorators
@FrontMcp - Bootstrap MCP server
@App - Define application modules
Entry Decorators
@Tool - Define MCP tools
@Resource / @ResourceTemplate - Define resources
@Prompt - Define prompt templates
@Agent - Define autonomous agents
@Skill - Define knowledge packages
@Job - Define executable jobs
@Workflow - Define multi-step workflows
Extension Decorators
@Plugin - Create plugins
@Provider - Dependency injection
@Adapter - Framework adapters
Hook Decorators
@Stage - Define flow stages
@Will - Before-stage hooks
@Did - After-stage hooks
@Around - Wrap-stage hooks
Class-Based vs Function-Based
Most entry decorators support both patterns:
Class-Based (Recommended for Complex Logic)
import { Tool , ToolContext } from ' @frontmcp/sdk ' ;
import { z } from ' @frontmcp/sdk ' ;
@ Tool ({
name : ' get_user ' ,
description : ' Fetch user by ID ' ,
inputSchema : { userId : z . string () },
})
class GetUserTool extends ToolContext {
async execute ( input : { userId : string }) {
const db = this . get ( DatabaseToken );
return db . findUser ( input . userId );
}
}
Function-Based (Simpler Definitions)
import { tool } from ' @frontmcp/sdk ' ;
import { z } from ' @frontmcp/sdk ' ;
const getUserTool = tool ({
name : ' get_user ' ,
description : ' Fetch user by ID ' ,
inputSchema : { userId : z . string () },
})(( input , ctx ) => {
const db = ctx . get ( DatabaseToken );
return db . findUser ( input . userId );
});
Type Inference
FrontMCP provides full type inference for inputs and outputs:
import { Tool , ToolContext , ToolInputOf , ToolOutputOf } from ' @frontmcp/sdk ' ;
import { z } from ' @frontmcp/sdk ' ;
const metadata = {
name : ' calculate ' ,
inputSchema : { a : z . number (), b : z . number () },
outputSchema : z . object ({ result : z . number () }),
} as const ;
// Types are inferred automatically
type Input = ToolInputOf < typeof metadata >; // { a: number; b: number }
type Output = ToolOutputOf < typeof metadata >; // { result: number }
// Types are auto-inferred from the @Tool decorator — use plain `ToolContext`.
@ Tool ( metadata )
class CalculateTool extends ToolContext {
async execute ( input : Input ): Promise < Output > {
return { result : input . a + input . b };
}
}
Common Patterns
All entry decorators share common metadata properties:
Property Type Description namestringRequired unique identifier descriptionstringHuman-readable description idstringOptional stable ID for tracking tagsstring[]Categorization tags
Context Access
All context classes provide:
// Dependency injection
const service = this . get ( ServiceToken );
const optional = this . tryGet ( OptionalToken );
// Scope access
const tools = this . scope . tools ;
// Logging
this . logger . info ( ' Processing request ' );
// Request context
const ctx = this . context ;
const auth = this . context . authInfo ;
Importing from External Packages
Decorators expose static .esm() and .remote() factories for declaring entries that come from outside the local source tree:
import { Tool , Resource , Prompt , Agent , Skill , Job , App } from ' @frontmcp/sdk ' ;
// Pull a named export from an installed npm package
const OpenAI_GenImage = Tool . esm ( ' @some-org/some-package ' , ' generate_image ' );
// Pull from a remote MCP server
const SearchAPI = Tool . remote ( ' https://search.example.com/mcp ' , ' search ' );
Both factories are available on Tool, Resource, Prompt, Agent, Skill, Job, and App. Pass the resulting handle into your @App or @FrontMcp decorator just like a class-based entry:
@ FrontMcp ({
info : { name : ' gateway ' , version : ' 1.0.0 ' },
tools : [
Tool . esm ( ' @some-org/some-package ' , ' generate_image ' ),
Tool . remote ( ' https://search.example.com/mcp ' , ' search ' ),
],
})
class Gateway {}
See the ESM Dynamic Loading feature for the full lifecycle, and Remote MCP servers for remote semantics.
Next Steps
@FrontMcp Bootstrap your MCP server
@Resource Define resources
@Prompt Create prompt templates
@Job Define executable jobs
@Workflow Define multi-step workflows