/** * 9plan_session_create tool * * Creates a new session with a randomly-generated three-word identifier. */ import { z } from "zod"; import { createNewSession, getSessionPath } from "../container.js"; import { formatResponse } from "../types.js"; // Input schema export const sessionCreateInputSchema = { task_description: z .string() .optional() .describe("Optional description of the overall task this session is for"), }; // Input type derived from schema export interface SessionCreateInput { task_description?: string; } /** * Handle session create tool call */ export function handleSessionCreate( args: SessionCreateInput, ): { content: { type: "text"; text: string }[] } { const { sessionName, store } = createNewSession(args.task_description); const sessionPath = getSessionPath(sessionName); // Close the store since we're just creating the session store.close(); const response = formatResponse( sessionName, `Session created: ${sessionName} Directory: ${sessionPath} The session is ready. Use 9plan_queue_add to add plans, then 9plan_queue_pull to begin work.`, ); return { content: [{ type: "text", text: response }], }; } // Tool configuration for registration export const sessionCreateToolConfig = { title: "Create Session", description: "Creates a new session with a randomly-generated three-word identifier (e.g., amber-quiet-river). Optionally provide a task description to document the overall goal.", inputSchema: sessionCreateInputSchema, };