Skip to main content
Glama
aaronfeingold

MCP Project Context Server

start_session

Begin a development session by specifying project ID and goals to maintain context between coding sessions.

Instructions

Start a new development session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID
goalsYesSession goals

Implementation Reference

  • The handler function that implements the core logic of the 'start_session' tool. It creates a new session using ProjectStore.createSession and returns a structured response with the session ID or error.
    async ({ projectId, goals }) => {
      try {
        const session = await this.store.createSession({
          projectId,
          startTime: new Date().toISOString(),
          goals,
          achievements: [],
          blockers: [],
          nextSession: [],
        });
        return {
          content: [
            {
              type: "text",
              text: `Session started with ID: ${session.sessionId}`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error starting session: ${
                error instanceof Error ? error.message : "Unknown error"
              }`,
            },
          ],
        };
      }
    }
  • Input schema definition for the 'start_session' tool using Zod, specifying projectId and goals.
    inputSchema: {
      projectId: z.string().describe("Project ID"),
      goals: z.array(z.string()).describe("Session goals"),
    },
  • src/server.ts:364-405 (registration)
    Registration of the 'start_session' tool with the McpServer instance in the setupTools method.
    this.server.registerTool(
      "start_session",
      {
        title: "Start Session",
        description: "Start a new development session",
        inputSchema: {
          projectId: z.string().describe("Project ID"),
          goals: z.array(z.string()).describe("Session goals"),
        },
      },
      async ({ projectId, goals }) => {
        try {
          const session = await this.store.createSession({
            projectId,
            startTime: new Date().toISOString(),
            goals,
            achievements: [],
            blockers: [],
            nextSession: [],
          });
          return {
            content: [
              {
                type: "text",
                text: `Session started with ID: ${session.sessionId}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error starting session: ${
                  error instanceof Error ? error.message : "Unknown error"
                }`,
              },
            ],
          };
        }
      }
    );
  • Helper method in ProjectStore that persists the new session to a JSON file after validation and generates a unique sessionId.
    async createSession(
      sessionData: Omit<SessionContext, "sessionId">
    ): Promise<SessionContext> {
      const session: SessionContext = {
        ...sessionData,
        sessionId: uuidv4(),
      };
    
      const validated = SessionContextSchema.parse(session);
      const filePath = path.join(this.sessionsDir, `${session.sessionId}.json`);
      await fs.writeJson(filePath, validated, { spaces: 2 });
    
      return validated;
    }

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/aaronfeingold/mcp-project-context'

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