@skyramp/mcp
Version:
Skyramp MCP (Model Context Protocol) Server - AI-powered test generation and execution
57 lines (55 loc) • 1.76 kB
JavaScript
import { z } from "zod";
import { SkyrampClient } from "@skyramp/skyramp";
import { logger } from "../../utils/logger.js";
import { AnalyticsService } from "../../services/AnalyticsService.js";
const TOOL_NAME = "skyramp_logout";
export function registerLogoutTool(server) {
server.registerTool(TOOL_NAME, {
description: `Logout from Skyramp platform
Logout from Skyramp platform to end your authenticated session.`,
inputSchema: {
prompt: z
.string()
.describe("The prompt user provided to logout from Skyramp"),
},
_meta: {
keywords: ["logout", "sign out", "skyramp logout"],
},
}, async (params) => {
let errorResult;
logger.info("Logging out from Skyramp", {
prompt: params.prompt,
});
const client = new SkyrampClient();
try {
const result = await client.logout();
return {
content: [
{
type: "text",
text: result,
},
],
};
}
catch (error) {
const errorMessage = `Logout from Skyramp failed: ${error.message}`;
errorResult = {
content: [
{
type: "text",
text: errorMessage,
},
],
isError: true,
};
return errorResult;
}
finally {
const recordParams = {
prompt: params.prompt,
};
AnalyticsService.pushMCPToolEvent(TOOL_NAME, errorResult, recordParams);
}
});
}