Skip to main content
Glama
mmntm

Weblate MCP Server

by mmntm

getProjectDashboard

Generate a detailed dashboard to track and analyze project statistics, including translation components, using the project slug for Weblate MCP Server.

Instructions

Get a comprehensive dashboard overview for a project with all component statistics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectSlugYesThe slug of the project

Implementation Reference

  • The primary handler for the 'getProjectDashboard' tool, including @Tool decorator with name, description, input schema, and the async function logic that delegates to the statistics service and formats the response.
    @Tool({ name: 'getProjectDashboard', description: 'Get a comprehensive dashboard overview for a project with all component statistics', parameters: z.object({ projectSlug: z.string().describe('The slug of the project'), }), }) async getProjectDashboard({ projectSlug }: { projectSlug: string }) { try { const dashboard = await this.statisticsService.getProjectDashboard(projectSlug); return { content: [ { type: 'text', text: this.formatProjectDashboard(projectSlug, dashboard), }, ], }; } catch (error) { this.logger.error(`Failed to get project dashboard for ${projectSlug}`, error); return { content: [ { type: 'text', text: `Error getting project dashboard: ${error.message}`, }, ], isError: true, }; }
  • The WeblateStatisticsTool class is registered as a provider in the AppModule, enabling NestJS to discover and expose its @Tool-decorated methods as MCP tools.
    WeblateStatisticsTool,
  • Core helper method in the statistics service that aggregates project statistics and per-component statistics to construct the full dashboard data.
    /** * Get dashboard overview for a project with all component statistics */ async getProjectDashboard(projectSlug: string) { try { // Get project info and components const [projectStats, components] = await Promise.all([ this.getProjectStatistics(projectSlug), this.componentsService.listComponents(projectSlug), ]); // Get statistics for each component const componentStats = await Promise.all( components.map(async (component) => { try { const stats = await this.getComponentStatistics(projectSlug, component.slug); return { component: component.name, slug: component.slug, statistics: stats, }; } catch (error) { this.logger.warn(`Failed to get stats for component ${component.slug}`, error); return { component: component.name, slug: component.slug, statistics: null, error: error.message, }; } }), ); return { project: projectStats, components: componentStats, }; } catch (error) { this.logger.error(`Failed to get project dashboard for ${projectSlug}`, error); throw error; } }
  • Private helper function that formats the raw dashboard data into a human-readable markdown string with project summary and component breakdowns.
    private formatProjectDashboard(projectSlug: string, dashboard: any): string { const project = dashboard.project; const components = dashboard.components || []; let result = this.formatProjectStatistics(projectSlug, project); result += '\n\n## 📋 Component Breakdown\n\n'; components.forEach((comp: any, index: number) => { if (comp.statistics) { const stats = comp.statistics; const formatPercent = (value: any) => { return typeof value === 'number' ? `${value.toFixed(1)}%` : 'N/A'; }; result += `**${index + 1}. ${comp.component}** (${comp.slug}) - 🎯 Progress: ${formatPercent(stats.translated_percent)} - ✅ Approved: ${formatPercent(stats.approved_percent)} - 📝 Total Strings: ${stats.total || 'N/A'} `; } else { result += `**${index + 1}. ${comp.component}** (${comp.slug}) - ❌ Error: ${comp.error || 'Unable to load statistics'} `; } }); return result; }

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/mmntm/weblate-mcp'

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