Skip to main content
Glama

list_projects

Retrieve all projects from your local MyContext directory to manage project documentation organized in markdown files.

Instructions

List all available projects in the context directory (~/.mycontext/)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that lists all top-level project directories by ensuring the context directory exists and reading its subdirectories.
    async function listProjects(): Promise<string[]> { await ensureContextDir(); const entries = await fs.readdir(CONTEXT_DIR, { withFileTypes: true }); return entries.filter((e) => e.isDirectory()).map((e) => e.name); }
  • src/index.ts:159-167 (registration)
    Registration of the 'list_projects' tool in the ListToolsRequestSchema handler, including name, description, and empty input schema (no parameters required).
    { name: "list_projects", description: "List all available projects in the context directory (~/.mycontext/)", inputSchema: { type: "object", properties: {}, }, },
  • Execution handler within the CallToolRequestSchema switch that invokes listProjects and returns the formatted response.
    case "list_projects": { const projects = await listProjects(); return { content: [ { type: "text", text: JSON.stringify( { projects, context_directory: CONTEXT_DIR, }, null, 2 ), }, ], }; }
  • Helper function used by listProjects to ensure the context directory exists before listing projects.
    async function ensureContextDir() { try { await fs.access(CONTEXT_DIR); } catch { await fs.mkdir(CONTEXT_DIR, { recursive: true }); } }
  • Input schema definition for the list_projects tool (empty object, no required parameters).
    inputSchema: { type: "object", properties: {}, },

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/doko89/mcp-mycontext'

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