diff --git a/assets/js/app.ts b/assets/js/app.ts index 61293452..ff22ad17 100644 --- a/assets/js/app.ts +++ b/assets/js/app.ts @@ -2524,3 +2524,51 @@ if (process.env.NODE_ENV === "development") { window.liveReloader = reloader }) } + +// WebMCP: expose site tools to AI agents +// https://webmachinelearning.github.io/webmcp/ +if (typeof navigator !== "undefined" && (navigator as any).modelContext) { + (navigator as any).modelContext.provideContext({ + tools: [ + { + name: "navigate", + description: "Navigate to a page on TowerOps", + inputSchema: { + type: "object", + properties: { + path: { + type: "string", + description: "The path to navigate to, e.g. /dashboard or /users/register" + } + }, + required: ["path"] + }, + execute({ path }: { path: string }) { + window.location.href = path; + } + }, + { + name: "view_api_docs", + description: "Open the TowerOps API documentation", + inputSchema: { + type: "object", + properties: {} + }, + execute() { + window.location.href = "/docs/api"; + } + }, + { + name: "register", + description: "Start the registration flow for a new TowerOps account", + inputSchema: { + type: "object", + properties: {} + }, + execute() { + window.location.href = "/users/register"; + } + } + ] + }); +}