Skip to main content
Glama

set_cookies

Set authentication cookies for secure access to N Lobby school portal data, enabling users to view announcements, schedules, and learning resources.

Instructions

Set authentication cookies for N Lobby access

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cookiesYesCookie string from authenticated N Lobby session

Implementation Reference

  • src/server.ts:314-327 (registration)
    Registration of the 'set_cookies' tool including name, description, and input schema definition.
    name: "set_cookies", description: "Set authentication cookies for N Lobby access", inputSchema: { type: "object", properties: { cookies: { type: "string", description: "Cookie string from authenticated N Lobby session", }, }, required: ["cookies"], }, },
  • MCP server tool handler for 'set_cookies' that extracts the cookies argument and delegates to the API client's setCookies method, returning a success message.
    case "set_cookies": { const { cookies } = args as { cookies: string }; this.api.setCookies(cookies); return { content: [ { type: "text", text: "Authentication cookies have been set. You can now access real N Lobby data.", }, ], }; }
  • Core setCookies implementation in NextAuthHandler that parses incoming cookie string using parseCookies and stores the extracted tokens (sessionToken, csrfToken, callbackUrl).
    setCookies(cookieString: string): void { this.cookies = this.parseCookies(cookieString); logger.debug("NextAuth cookies parsed:", { hasSessionToken: !!this.cookies.sessionToken, hasCsrfToken: !!this.cookies.csrfToken, hasCallbackUrl: !!this.cookies.callbackUrl, }); }
  • TypeScript interface defining the structure of NextAuth cookies parsed and used by the setCookies functionality.
    export interface NextAuthCookies { sessionToken?: string; csrfToken?: string; callbackUrl?: string; }
  • Helper method that parses raw semicolon-separated cookie string into structured NextAuthCookies object, extracting specific NextAuth.js cookie values.
    parseCookies(cookieString: string): NextAuthCookies { const cookies: NextAuthCookies = {}; const cookiePairs = cookieString.split(";"); for (const pair of cookiePairs) { const [name, value] = pair.trim().split("="); if (name && value) { // Handle NextAuth.js cookie names if (name === "__Secure-next-auth.session-token") { cookies.sessionToken = decodeURIComponent(value); } else if (name === "__Host-next-auth.csrf-token") { cookies.csrfToken = decodeURIComponent(value); } else if (name === "__Secure-next-auth.callback-url") { cookies.callbackUrl = decodeURIComponent(value); } } } return cookies; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/minagishl/nlobby-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server