list_projects
View all projects in your workspace to manage development tasks and track progress.
Instructions
Lists all projects in the user workspace. No input parameters required as the workspace is automatically determined from the API key authentication.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/list-projects.ts:88-131 (handler)The execute method that implements the core logic of the list_projects tool: fetches projects from the CodeRide API endpoint `/project/list`, formats the response, and handles errors.async execute(input: ListProjectsInput): Promise<unknown> { logger.info('Executing list-projects tool', input); try { // Use the injected API client to get project list if (!this.apiClient) { throw new Error('API client not available - tool not properly initialized'); } const url = `/project/list`; logger.debug(`Making GET request to: ${url}`); const responseData = await this.apiClient.get<ProjectListApiResponse[]>(url) as unknown as ProjectListApiResponse[]; if (!responseData || !Array.isArray(responseData)) { logger.warn(`No projects found or invalid response format from ${url}`); return { projects: [] }; } // Return formatted project list return { projects: responseData.map(project => ({ id: project.id, name: project.name, description: project.description, slug: project.slug, // status: project.status || 'draft', // Fallback for projects without status workspace: { id: project.workspace?.id || '', name: project.workspace?.name || '' } })), totalCount: responseData.length }; } catch (error) { const errorMessage = (error instanceof Error) ? error.message : 'An unknown error occurred'; logger.error(`Error in project-list tool: ${errorMessage}`, error instanceof Error ? error : undefined); return { isError: true, content: [{ type: "text", text: errorMessage }] }; } }
- src/tools/list-projects.ts:11-20 (schema)Zod schema and TypeScript type definition for the list_projects tool input. No parameters are required as workspace is determined from the API key./** * Schema for the list-projects tool input * No input parameters required - workspace is extracted from API key */ const ListProjectsSchema = z.object({}).strict(); /** * Type for the list-projects tool input */ type ListProjectsInput = z.infer<typeof ListProjectsSchema>;
- src/index.ts:315-330 (registration)Instantiation of ListProjectsTool with secureApiClient dependency injection and registration with the MCP server via tool.register(server).const tools: any[] = [ new StartProjectTool(secureApiClient), new GetPromptTool(secureApiClient), new GetTaskTool(secureApiClient), new GetProjectTool(secureApiClient), new UpdateTaskTool(secureApiClient), new UpdateProjectTool(secureApiClient), new ListProjectsTool(secureApiClient), new ListTasksTool(secureApiClient), new NextTaskTool(secureApiClient), ]; // Register each tool with the server tools.forEach(tool => { tool.register(server); });
- src/index.ts:30-30 (registration)Import statement for the ListProjectsTool class.import { ListProjectsTool } from './tools/list-projects.js';
- src/tools/list-projects.ts:62-83 (helper)Helper method to generate agent instructions after executing list_projects, providing guidance for next steps.protected generateAgentInstructions(input: ListProjectsInput, result: any): AgentInstructions { return { immediateActions: [ "Review available projects and their descriptions", "Help user select appropriate project for their work", "Consider project scope and current status for selection" ], nextRecommendedTools: ["start_project", "get_project"], workflowPhase: 'discovery', criticalReminders: [ "Use start_project for new project initialization", "Use get_project to understand existing project context" ], automationHints: { projectSelection: "Guide user to select projects based on their current objectives", workflowGuidance: { newProject: "Use start_project for project initialization", existingProject: "Use get_project to establish project context" } } }; }