generate_session
Create structured Learning Hour content for Technical Coaches to facilitate deliberate practice sessions on technical topics like Feature Envy or DRY Principle.
Instructions
Generate comprehensive Learning Hour content for Technical Coaches
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic | Yes | The learning topic (e.g., 'Feature Envy', 'DRY Principle') | |
| style | No | Presentation style: slide (default), vertical, or workshop | slide |
Implementation Reference
- src/index.ts:269-290 (handler)The primary handler method for the 'generate_session' MCP tool. Parses input arguments using Zod schema, delegates to LearningHourGenerator.generateSessionContent, and returns formatted content block.public async generateSession(args: any) { const input = GenerateSessionInputSchema.parse(args); try { const sessionData = await this.generator.generateSessionContent(input.topic, input.style); return { content: [ { type: "text", text: `✅ Learning Hour session generated for: ${input.topic}`, }, { type: "text", text: JSON.stringify(sessionData, null, 2), }, ], }; } catch (error) { throw new Error(`Failed to generate session: ${error instanceof Error ? error.message : String(error)}`); } }
- src/index.ts:97-115 (registration)Tool registration in ListToolsRequestHandler. Defines name, description, and input schema for the MCP server.{ name: "generate_session", description: "Generate comprehensive Learning Hour content for Technical Coaches", inputSchema: { type: "object", properties: { topic: { type: "string", description: "The learning topic (e.g., 'Feature Envy', 'DRY Principle')", }, style: { type: "string", description: "Presentation style: slide (default), vertical, or workshop", default: "slide" }, }, required: ["topic"], }, },
- src/index.ts:20-23 (schema)Zod schema used for input validation in the generateSession handler.const GenerateSessionInputSchema = z.object({ topic: z.string().min(1, "Topic is required"), style: z.string().optional().default('slide'), });
- src/LearningHourGenerator.ts:383-408 (helper)Core implementation that generates session content by constructing a detailed prompt and calling the Anthropic Claude API. This is the actual logic execution delegated from the MCP handler.async generateSessionContent(topic: string, style: string = 'slide'): Promise<SessionContent> { const prompt = this.buildSessionPrompt(topic, style); try { const message = await this.client.messages.create({ model: this.model, max_tokens: 3000, messages: [{ role: 'user', content: prompt }] }); const textContent = message.content.find(block => block.type === 'text'); if (!textContent || textContent.type !== 'text') { throw new Error('No text content in response'); } const content = textContent.text; const sessionData = JSON.parse(content); this.validateSessionContent(sessionData); return sessionData; } catch (error) { throw new Error(`Failed to generate session: ${error instanceof Error ? error.message : String(error)}`); } }
- src/LearningHourGenerator.ts:28-36 (schema)TypeScript interface defining the structure of the SessionContent returned by generateSessionContent.export interface SessionContent { topic: string; sessionOverview: string; learningObjectives: string[]; activities: LearningActivity[]; discussionPrompts: string[]; keyTakeaways: string[]; miroContent: MiroContent; }