listProjects
Retrieve all translation projects available in Weblate for management and overview.
Instructions
List all available Weblate projects
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/projects.tool.ts:17-43 (handler)The handler function that implements the core logic of the 'listProjects' tool. It fetches projects using WeblateApiService, formats them into a markdown list, and returns them in the expected MCP content format. Handles errors gracefully.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/tools/projects.tool.ts:12-16 (registration)The @Tool decorator registers the 'listProjects' function as an MCP tool, providing the name, description, and input schema (empty object since no parameters).@Tool({ name: 'listProjects', description: 'List all available Weblate projects', parameters: z.object({}), })
- src/tools/projects.tool.ts:15-15 (schema)Zod schema defining the input parameters for the tool (no parameters required).parameters: z.object({}),