Skip to main content
Glama

list_projects

View all Claude Code projects and their session counts to track development progress and manage conversations.

Instructions

List all Claude Code projects with session counts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that lists all Claude Code projects by scanning the ~/.claude/projects directory, counting session files (.jsonl) in each project directory.
    export const listProjects = Effect.gen(function* () { const sessionsDir = getSessionsDir() const exists = yield* Effect.tryPromise(() => fs .access(sessionsDir) .then(() => true) .catch(() => false) ) if (!exists) { return [] as Project[] } const entries = yield* Effect.tryPromise(() => fs.readdir(sessionsDir, { withFileTypes: true })) const projects = yield* Effect.all( entries .filter((e) => e.isDirectory()) .map((entry) => Effect.gen(function* () { const projectPath = path.join(sessionsDir, entry.name) const files = yield* Effect.tryPromise(() => fs.readdir(projectPath)) const sessionFiles = files.filter((f) => f.endsWith('.jsonl')) return { name: entry.name, path: projectPath, sessionCount: sessionFiles.length, } satisfies Project }) ), { concurrency: 10 } ) return projects })
  • src/mcp/index.ts:14-20 (registration)
    Registers the 'list_projects' MCP tool with no input parameters. The handler runs session.listProjects and returns the result as formatted JSON text content.
    // List all projects server.tool('list_projects', 'List all Claude Code projects with session counts', {}, async () => { const result = await Effect.runPromise(session.listProjects) return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], } })
  • TypeScript schema definition for Project type used in listProjects output, defining name, path, and sessionCount fields.
    export const ProjectSchema = Schema.Struct({ name: Schema.String, path: Schema.String, sessionCount: Schema.Number, }) export type Project = Schema.Schema.Type<typeof ProjectSchema>

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/DrumRobot/claude-sessions-mcp'

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