use std::sync::Arc;
use tower_mcp::McpRouter;
use crate::Town;
use super::prompts;
use super::resources;
use super::tools;
#[derive(Clone)]
pub struct McpState {
pub town: Town,
}
impl McpState {
pub fn new(town: Town) -> Self {
Self { town }
}
}
pub fn create_mcp_router(state: Arc<McpState>, server_name: &str, version: &str) -> McpRouter {
let mut router = McpRouter::new()
.server_info(server_name, version)
.instructions(
"Tinytown MCP interface for multi-agent orchestration. \
Use tools to manage agents, assign tasks, and monitor town status. \
Resources provide read-only snapshots of town state. \
Prompts help generate context for conductor and agent operations.",
);
for tool in tools::all_tools(state.clone()) {
router = router.tool(tool);
}
for resource in resources::all_resources(state.clone()) {
router = router.resource(resource);
}
for template in resources::all_templates(state.clone()) {
router = router.resource_template(template);
}
for prompt in prompts::all_prompts(state) {
router = router.prompt(prompt);
}
router
}
#[cfg(test)]
mod tests {
#[tokio::test]
async fn test_create_mcp_router() {
}
}