Skip to main content
Glama

create-session

Initiate a new session on the MCP server for advanced code analysis, enabling syntax checks, dependency mapping, and AI-driven development workflow optimization, with optional session descriptions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoOptional description for this session

Implementation Reference

  • Handler function that executes the create-session tool: retrieves or creates a session, generates session ID, and returns a JSON success response with session details.
    async ({ description }) => { try { const session = getSession(); const sessionId = session.getSessionId(); const result = createSuccessResponse( { sessionId, description, created: new Date().toISOString() }, "create-session" ); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify( createErrorResponse( error instanceof Error ? error.message : String(error), "create-session" ), null, 2 ), }, ], isError: true, }; } }
  • Zod input schema for the create-session tool, defining an optional 'description' string parameter.
    { description: z .string() .optional() .describe("Optional description for this session"), },
  • Registration of the 'create-session' tool on the MCP server using server.tool(), including inline schema and handler.
    server.tool( "create-session", { description: z .string() .optional() .describe("Optional description for this session"), }, async ({ description }) => { try { const session = getSession(); const sessionId = session.getSessionId(); const result = createSuccessResponse( { sessionId, description, created: new Date().toISOString() }, "create-session" ); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify( createErrorResponse( error instanceof Error ? error.message : String(error), "create-session" ), null, 2 ), }, ], isError: true, }; } } );

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/0xjcf/MCP_CodeAnalysis'

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