Extending with Custom Tools
Register custom MCP tools and prompts from your own modules and applications at runtime.
π§ Getting the Server Instance
var server = mcpServer( "boxlang" )π οΈ Registering a Simple Tool
server.registerTool(
aiTool(
"check_deployment_status",
"Check the current deployment status of the application",
( environment ) => {
var status = deploymentService.getStatus( environment )
return {
environment: arguments.environment,
version: status.version,
deployedAt: status.deployedAt.toString(),
healthy: status.healthy
}
}
)
.addParameter(
aiToolParam( "environment", "string", "The deployment environment to check (e.g., staging, production)" )
.required()
)
)How it Works
π Registering a Custom Prompt
π Classpath Scanning
π¦ Batch Registration
π Accessing Existing Tools
ποΈ Best Practices for Registration
Module Startup (Recommended)
Application Startup
ColdBox Applications
Use Descriptive Names
Return Structured Data
π‘ Complete Working Example
π Next Steps
Last updated
Was this helpful?
