Skip to main content
Glama
aaronfeingold

MCP Project Context Server

Get Project Context

get_project_context

Retrieve comprehensive project context including technology stack, tasks, decisions, and session history to maintain continuity between coding sessions without re-explaining project details.

Instructions

Get comprehensive project context and current state

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID

Implementation Reference

  • The MCP tool handler function for 'get_project_context'. It retrieves the project context from ContextManager and returns it as MCP-formatted text content, with error handling.
    async ({ projectId }) => {
      try {
        const context = await this.contextManager.getCurrentContext(
          projectId
        );
        return {
          content: [
            {
              type: "text",
              text: context,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error getting project context: ${
                error instanceof Error ? error.message : "Unknown error"
              }`,
            },
          ],
        };
      }
    }
  • Tool metadata and input schema definition (Zod schema requiring projectId string).
    {
      title: "Get Project Context",
      description: "Get comprehensive project context and current state",
      inputSchema: {
        projectId: z.string().describe("Project ID"),
      },
    },
  • src/server.ts:91-126 (registration)
    Registration of the 'get_project_context' tool on the MCP server using registerTool, including schema and handler.
    this.server.registerTool(
      "get_project_context",
      {
        title: "Get Project Context",
        description: "Get comprehensive project context and current state",
        inputSchema: {
          projectId: z.string().describe("Project ID"),
        },
      },
      async ({ projectId }) => {
        try {
          const context = await this.contextManager.getCurrentContext(
            projectId
          );
          return {
            content: [
              {
                type: "text",
                text: context,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error getting project context: ${
                  error instanceof Error ? error.message : "Unknown error"
                }`,
              },
            ],
          };
        }
      }
    );
  • Helper method in ContextManager that implements the core logic: fetches project and sessions from store, formats a detailed markdown context summary including status, tech stack, tasks, next steps, last session, and recent decisions.
      async getCurrentContext(projectId: string): Promise<string> {
        const project = await this.store.getProject(projectId);
        if (!project) {
          return "Project not found";
        }
    
        const recentSessions = await this.store.getProjectSessions(projectId);
        const lastSession = recentSessions[0];
    
        return `
    # Project: ${project.name}
    
    ## Current Status: ${project.status}
    ${project.description}
    
    ## Current Phase: ${project.currentPhase}
    
    ## Tech Stack:
    - Frontend: ${project.techStack.frontend.join(", ") || "Not specified"}
    - Backend: ${project.techStack.backend.join(", ") || "Not specified"}
    - Database: ${project.techStack.database.join(", ") || "Not specified"}
    - Infrastructure: ${
          project.techStack.infrastructure.join(", ") || "Not specified"
        }
    
    ## Active Tasks (${
          project.tasks.filter((t) => t.status !== "completed").length
        }):
    ${
      project.tasks
        .filter((t) => t.status !== "completed")
        .map(
          (t) =>
            `- [${t.status.toUpperCase()}] ${t.title} (Priority: ${t.priority})`
        )
        .join("\n") || "No active tasks"
    }
    
    ## Next Steps:
    ${
      project.nextSteps.map((step) => `- ${step}`).join("\n") ||
      "No next steps defined"
    }
    
    ## Last Session Summary:
    ${
      lastSession
        ? `
    - Goals: ${lastSession.goals.join(", ")}
    - Achievements: ${lastSession.achievements.join(", ")}
    - Blockers: ${lastSession.blockers.join(", ")}
    - Next Session Plan: ${lastSession.nextSession.join(", ")}
    `
        : "No previous sessions"
    }
    
    ## Recent Decisions:
    ${
      project.decisions
        .slice(0, 3)
        .map(
          (d) => `- ${d.decision} (${new Date(d.timestamp).toLocaleDateString()})`
        )
        .join("\n") || "No recent decisions"
    }
    `.trim();
      }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'gets' information, implying a read-only operation, but doesn't clarify permissions, rate limits, or what 'comprehensive context' entails (e.g., includes tasks, notes, decisions). For a tool with no annotations, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence: 'Get comprehensive project context and current state'. It's front-loaded with the core purpose and avoids unnecessary words. However, it could be slightly more specific without losing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (retrieving project context), no annotations, no output schema, and a simple input schema, the description is minimally adequate. It states what the tool does but lacks details on return values, behavioral constraints, or usage context. It meets the bare minimum for a read operation but leaves the agent guessing about the output format and scope.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the single parameter 'projectId' documented as 'Project ID'. The description doesn't add any parameter-specific details beyond what the schema provides, but with only one parameter and high schema coverage, the baseline is high. No additional value is added, but no compensation is needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool's purpose as 'Get comprehensive project context and current state', which is clear but vague. It specifies the verb 'Get' and resource 'project context', but doesn't distinguish it from potential sibling tools like 'list_projects' or provide specifics about what 'comprehensive context' includes. This is adequate but lacks differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'list_projects' and 'create_project', there's no indication of when this retrieval tool is appropriate versus listing or creating projects. The agent must infer usage from the name and description alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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