Skip to main content
Glama

list_projects

Retrieve all logged conversation projects to track AI-developer interactions, with optional statistics for analysis and continuity management.

Instructions

List all projects with optional statistics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeStatsNoInclude statistics for each project

Implementation Reference

  • Main tool handler: validates input with validateListProjects, lists projects via fileManager.listProjects(), optionally computes stats with getProjectStats, and returns formatted markdown response.
    async listProjects(params: unknown): Promise<{ content: Array<{ type: string; text: string }> }> {
      try {
        const validatedParams = validateListProjects(params);
        const { includeStats } = validatedParams;
        const projects = await this.fileManager.listProjects();
    
        if (projects.length === 0) {
          return {
            content: [
              {
                type: 'text',
                text: '📁 暂无项目记录。\n\n使用 log_conversation 工具开始记录对话到新项目。'
              }
            ]
          };
        }
    
        let result = `📁 共找到 ${projects.length} 个项目:\n\n`;
    
        if (includeStats) {
          for (const project of projects) {
            const stats = await this.getProjectStats(project);
            result += `## ${stats.name}\n`;
            result += `- 总对话数: ${stats.totalConversations}\n`;
            result += `- 最后活动: ${stats.lastActivity}\n`;
            result += `- 支持平台: ${stats.platforms.join(', ') || '无'}\n`;
            result += `- 常用标签: ${stats.tags.slice(0, 5).join(', ') || '无'}\n\n`;
          }
        } else {
          projects.forEach(project => {
            result += `- ${project}\n`;
          });
        }
    
        return {
          content: [
            {
              type: 'text',
              text: result
            }
          ]
        };
      } catch (error) {
        const errorMessage = error instanceof ValidationError 
          ? `参数验证失败: ${error.message}`
          : `获取项目列表时出错: ${String(error)}`;
        
        return {
          content: [
            {
              type: 'text',
              text: `❌ ${errorMessage}`
            }
          ]
        };
      }
    }
  • Zod schema definition for list_projects input parameters.
    export const ListProjectsSchema = z.object({
      includeStats: z.boolean().optional().default(false)
    });
  • src/index.ts:170-171 (registration)
    Tool dispatch/registration in the CallToolRequest handler switch statement.
    case 'list_projects':
      return await this.conversationLogger.listProjects(args || {});
  • src/index.ts:139-151 (registration)
    Tool metadata registration (name, description, inputSchema) in the ListToolsRequest handler.
      name: 'list_projects',
      description: 'List all projects with optional statistics',
      inputSchema: {
        type: 'object',
        properties: {
          includeStats: {
            type: 'boolean',
            description: 'Include statistics for each project',
            default: false
          }
        }
      }
    }
  • Core utility method that lists projects by checking registry, current project, or scanning projects directory.
    async listProjects(): Promise<string[]> {
      // For the new design, we primarily work with the current project
      // But we can also scan the global registry for known projects
      const registryPath = join(this.getIndexDir(), 'projects-registry.json');
      
      try {
        const registryContent = await this.readFile(registryPath);
        if (registryContent) {
          const registry = JSON.parse(registryContent);
          return Object.keys(registry);
        }
      } catch {
        // Registry doesn't exist or is corrupted
      }
      
      // If no registry, return current project if detected
      const projectInfo = await this.getProjectInfo();
      if (projectInfo.root) {
        return [projectInfo.name];
      }
      
      // Fallback: scan home config directory
      try {
        const projectsDir = join(this.homeConfigDir, 'projects');
        const entries = await fs.readdir(projectsDir, { withFileTypes: true });
        return entries
          .filter(entry => entry.isDirectory())
          .map(entry => entry.name);
      } catch (error) {
        if ((error as { code?: string }).code === 'ENOENT') {
          return [];
        }
        const projectsDir = join(this.homeConfigDir, 'projects');
        throw new FileOperationError(`Failed to list projects`, projectsDir, 'readdir');
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool lists projects but doesn't cover critical aspects like whether it's read-only (implied by 'list'), pagination behavior, rate limits, authentication needs, or what happens if no projects exist. The mention of 'optional statistics' hints at output behavior but lacks detail.

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 that front-loads the core action ('List all projects') and adds a useful detail ('with optional statistics'). There is zero waste, and every word earns its place, making it easy to parse quickly.

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?

For a tool with no annotations and no output schema, the description is incomplete. It doesn't explain the return format (e.g., list structure, fields), error conditions, or behavioral traits like pagination. The mention of statistics is vague, and without output schema, the agent lacks guidance on what to expect from the tool's execution.

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

Parameters3/5

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

Schema description coverage is 100%, with the parameter 'includeStats' fully documented in the schema. The description adds minimal value by mentioning 'optional statistics', which aligns with the schema but doesn't provide additional context like what statistics are included or why to use them. Baseline 3 is appropriate since the schema does the heavy lifting.

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'), making the purpose immediately understandable. It distinguishes the action from siblings like 'search_conversations' by focusing on listing rather than searching. However, it doesn't specify the scope (e.g., all projects accessible to the user) or differentiate from 'get_context_suggestions' in terms of resource type.

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 like 'search_conversations' or 'get_context_suggestions'. It mentions 'optional statistics' but doesn't explain when to include them or any prerequisites. Usage context is implied at best, with no explicit when/when-not instructions.

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/fablefang/ai-conversation-logger-mcp'

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