listProjects
Retrieve all available translation projects in the Weblate MCP Server to manage, access, and organize multilingual content efficiently.
Instructions
List all available Weblate projects
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/projects.tool.ts:12-43 (handler)MCP tool handler for listProjects: decorated function that fetches projects from WeblateApiService and returns formatted text content or error.@Tool({ name: 'listProjects', description: 'List all available Weblate projects', parameters: z.object({}), }) async listProjects() { try { const projects = await this.weblateApiService.listProjects(); return { content: [ { type: 'text', text: `Found ${projects.length} projects:\n\n${projects .map((p) => `- **${p.name}** (${p.slug})\n URL: ${p.web_url}`) .join('\n\n')}`, }, ], }; } catch (error) { this.logger.error('Failed to list projects', error); return { content: [ { type: 'text', text: `Error listing projects: ${error.message}`, }, ], isError: true, }; } }
- src/app.module.ts:74-74 (registration)Registration of WeblateProjectsTool in AppModule providers, making the tool available to McpModule.WeblateProjectsTool,
- Helper service method implementing the core logic to list Weblate projects via API client.async listProjects(): Promise<Project[]> { try { const client = this.weblateClientService.getClient(); const response = await projectsList({ client }); // The generated client returns the response with data field const projects = response.data; // Check if response.data is an array directly (some APIs return array directly) if (Array.isArray(projects)) { return projects; } // Check if response.data.results exists (paginated response) if (projects && Array.isArray(projects.results)) { return projects.results; } return []; } catch (error) { this.logger.error('Failed to list projects', error); throw new Error(`Failed to list projects: ${error.message}`); } }
- src/tools/projects.tool.ts:15-15 (schema)Zod schema for listProjects tool parameters: empty object (no parameters).parameters: z.object({}),
- Proxy helper in WeblateApiService delegating to projectsService.listProjects().async listProjects(): Promise<Project[]> { return this.projectsService.listProjects(); }