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.
Class Definition
export class Scope extends ScopeEntry {
readonly id : string ;
readonly logger : FrontMcpLogger ;
readonly entryPath : string ;
readonly routeBase : string ;
readonly ready : Promise < void >;
readonly metadata : ScopeMetadata ;
}
Properties
Property Type Description idstringUnique scope identifier loggerFrontMcpLoggerScope-specific logger entryPathstringHTTP entry path routeBasestringRoute prefix readyPromise<void>Initialization promise metadataScopeMetadataConfiguration metadata
ScopeMetadata is a union type:
type ScopeMetadata = AppScopeMetadata | MultiAppScopeMetadata ;
AppScopeMetadata — Used for single-app scopes (created when splitByApp splits each app into its own scope). Contains a single apps: [AppType] entry plus the parent server config (info, auth, etc.).
MultiAppScopeMetadata — Used for multi-app scopes (the default). Contains apps: AppType[] with all registered apps.
Both include an id field (unique scope identifier) and the full server configuration from @FrontMcp(). Defined in libs/sdk/src/common/metadata/front-mcp.metadata.ts.
Registry Accessors
Get the tool registry.
get tools () : ToolRegistry
const tools = scope . tools . getTools ();
const tool = scope . tools . findByName ( ' my_tool ' );
resources
Get the resource registry.
get resources () : ResourceRegistry
const resources = scope . resources . getResources ();
const templates = scope . resources . getResourceTemplates ();
const resource = scope . resources . findResourceForUri ( ' config://app ' );
prompts
Get the prompt registry.
get prompts () : PromptRegistry
const prompts = scope . prompts . getPrompts ();
const prompt = scope . prompts . findByName ( ' research ' );
agents
Get the agent registry.
get agents () : AgentRegistry
const agents = scope . agents . getAgents ();
const agent = scope . agents . findByName ( ' research-agent ' );
skills
Get the skill registry.
get skills () : SkillRegistry
const skills = scope . skills . getSkills ();
const searchResults = await scope . skills . search ( ' code review ' , { topK : 5 });
providers
Get the provider registry.
get providers () : ProviderRegistry
const service = scope . providers . get ( ServiceToken );
auth
Get the primary auth provider.
authProviders
Get the auth registry.
get authProviders () : AuthRegistry
apps
Get the app registry.
hooks
Get the hook registry.
get hooks () : HookRegistryInterface
plugins
Get the plugin registry (if configured).
get plugins () : PluginRegistry | undefined
Service Accessors
notifications
Get the notification service.
get notifications () : NotificationService
scope . notifications . on ( ' tool-called ' , ( event ) => {
console . log ( ' Tool called: ' , event . toolName );
});
elicitationStore
Get the elicitation store.
get elicitationStore () : ElicitationStore
eventStore
Get the event store (if configured).
get eventStore () : EventStore | undefined
skillSession
Get the skill session manager (if skills exist).
get skillSession () : SkillSessionManager | undefined
Get the tool UI registry.
get toolUI () : ToolUIRegistry
Flow Execution
Execute a named flow.
runFlow < Name extends FlowName >(
name : Name ,
input : FlowInputOf < Name >,
deps ?: Map < Token , Type >
) : Promise < FlowOutputOf < Name > | undefined >
const result = await scope . runFlow ( ' tools:call-tool ' , {
request : {
method : ' tools/call ' ,
params : { name : ' my_tool ' , arguments : { input : ' test ' } },
},
ctx : { authInfo },
});
Execute a flow and assert output exists.
runFlowForOutput < Name extends FlowName >(
name : Name ,
input : FlowInputOf < Name >,
deps ?: Map < Token , Type >
) : Promise < FlowOutputOf < Name >>
registryFlows(…flows)
Register additional flows.
registryFlows (... flows : FlowType []) : Promise < void >
Accessing Scope
@ Tool ({ name : ' my_tool ' , inputSchema : {} })
class MyTool extends ToolContext {
async execute () {
// Access scope
const tools = this . scope . tools ;
const resources = this . scope . resources ;
// List other tools
const allTools = tools . getTools ();
return { toolCount : allTools . length };
}
}
From FrontMcpInstance
const instance = await FrontMcpInstance . createForGraph ( config );
const scopes = instance . getScopes ();
const scope = scopes [ 0 ];
console . log ( ' Tools: ' , scope . tools . getTools (). length );
From DirectClient
The scope is internal to DirectClient, accessed through its methods:
const client = await connect ( config );
const tools = await client . listTools (); // Uses scope.tools internally
Usage Examples
Introspection
const instance = await FrontMcpInstance . createForGraph ( config );
const [ scope ] = instance . getScopes ();
// List all tools
scope . tools . getTools (). forEach ( tool => {
console . log ( ` Tool: ${ tool . name } ` );
console . log ( ` Description: ${ tool . description } ` );
console . log ( ` Input: ${ JSON . stringify ( tool . inputSchema ) } ` );
});
// List all resources
scope . resources . getResources (). forEach ( resource => {
console . log ( ` Resource: ${ resource . name } - ${ resource . uri } ` );
});
// List all skills
scope . skills . getSkills (). forEach ( skill => {
console . log ( ` Skill: ${ skill . name } ` );
console . log ( ` Tools: ${ skill . tools . map ( t => t . name ). join ( ' , ' ) } ` );
});
Event Handling
const scope = instance . getScopes ()[ 0 ];
// Subscribe to tool changes
scope . tools . subscribe ({}, ( event ) => {
console . log ( ` Tool ${ event . kind } : ` , event );
});
// Subscribe to notifications
scope . notifications . on ( ' progress ' , ( event ) => {
console . log ( ` Progress: ${ event . progress } / ${ event . total } ` );
});
Skill Sessions
const scope = instance . getScopes ()[ 0 ];
if ( scope . skillSession ) {
// Get allowed tools for a session
const allowed = await scope . skillSession . getAllowedTools ( sessionId );
// Check if tool is allowed
const canUse = await scope . skillSession . isToolAllowed ( sessionId , ' my_tool ' );
}
Initialization Sequence
The Scope initializes in this order:
Providers
Hooks
Flows
Transport Service
Elicitation Store
Auth Registry
Apps Registry
Plugins
Tools Registry
Tool UI Registry
Resources Registry
Prompts Registry
Agents Registry
Skills Registry + Session Manager
Notification Service
Additional Flows
FrontMcpInstance Server bootstrap
ToolRegistry Tool registry
ResourceRegistry Resource registry
SkillRegistry Skill registry