Skip to main content
Glama
aaronfeingold

MCP Project Context Server

List Projects

list_projects

Retrieve all projects from the MCP Project Context Server, sorted by most recent access, to maintain coding context across sessions.

Instructions

List all projects ordered by last accessed

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'list_projects' tool. It calls ProjectStore.listProjects(), formats the projects into a markdown list sorted by last access, and returns MCP-formatted text content or error.
    async () => {
      try {
        const projects = await this.store.listProjects();
        const projectList = projects
          .map(
            (p) =>
              `- ${p.name} (${p.id}) - ${
                p.status
              } - Last accessed: ${new Date(
                p.lastAccessedAt
              ).toLocaleDateString()}`
          )
          .join("\n");
        return {
          content: [
            {
              type: "text",
              text: `Active Projects:\n${projectList || "No projects found"}`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error listing projects: ${
                error instanceof Error ? error.message : "Unknown error"
              }`,
            },
          ],
        };
      }
    }
  • src/server.ts:129-170 (registration)
    Registers the 'list_projects' tool with the MCP server, specifying its name, metadata, empty input schema, and handler function.
    this.server.registerTool(
      "list_projects",
      {
        title: "List Projects",
        description: "List all projects ordered by last accessed",
        inputSchema: {},
      },
      async () => {
        try {
          const projects = await this.store.listProjects();
          const projectList = projects
            .map(
              (p) =>
                `- ${p.name} (${p.id}) - ${
                  p.status
                } - Last accessed: ${new Date(
                  p.lastAccessedAt
                ).toLocaleDateString()}`
            )
            .join("\n");
          return {
            content: [
              {
                type: "text",
                text: `Active Projects:\n${projectList || "No projects found"}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error listing projects: ${
                  error instanceof Error ? error.message : "Unknown error"
                }`,
              },
            ],
          };
        }
      }
    );
  • Tool metadata and input schema definition (no input parameters required).
    {
      title: "List Projects",
      description: "List all projects ordered by last accessed",
      inputSchema: {},
    },
  • Supporting method in ProjectStore that lists all projects by reading JSON files from the data directory, validates with ProjectContextSchema, and sorts by lastAccessedAt descending.
    async listProjects(): Promise<ProjectContext[]> {
      const files = await fs.readdir(this.projectsDir);
      const projects: ProjectContext[] = [];
    
      for (const file of files) {
        if (file.endsWith(".json")) {
          const data = await fs.readJson(path.join(this.projectsDir, file));
          projects.push(ProjectContextSchema.parse(data));
        }
      }
    
      return projects.sort(
        (a, b) =>
          new Date(b.lastAccessedAt).getTime() -
          new Date(a.lastAccessedAt).getTime()
      );
    }
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. It states the ordering behavior ('ordered by last accessed'), which is useful. However, it lacks critical details: whether it's paginated, what fields are returned, if it requires authentication, or any rate limits. For a list operation with zero annotation coverage, this is a significant gap.

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

Conciseness5/5

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

The description is a single, efficient sentence with zero waste. It front-loads the core action ('List all projects') and adds a useful constraint ('ordered by last accessed') without unnecessary elaboration.

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

Completeness2/5

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

Given no annotations and no output schema, the description is incomplete. It doesn't explain the return format, pagination, or authentication needs. For a list tool that likely returns multiple items, this leaves the agent with insufficient context to use it effectively.

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 0 parameters with 100% coverage, so no parameter documentation is needed. The description adds no parameter information, which is appropriate. Baseline is 4 for zero parameters, as the schema fully covers the absence of inputs.

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

Purpose4/5

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

The description clearly states the verb ('List') and resource ('projects') with a specific ordering constraint ('ordered by last accessed'). It distinguishes from siblings like 'create_project' by indicating retrieval rather than creation. However, it doesn't explicitly differentiate from potential other listing tools (though none are present in the sibling list).

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. It doesn't mention prerequisites, context, or compare with siblings like 'get_project_context' for specific project details. The agent must infer usage solely from the tool name and description.

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