Skip to main content
Glama
gcorroto

SVN MCP Server

by gcorroto

svn_diagnose

Diagnose and resolve specific Subversion (SVN) command issues to maintain repository integrity and workflow efficiency.

Instructions

Diagnosticar problemas específicos con comandos SVN

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • index.ts:68-112 (handler)
    MCP server.tool registration and inline handler for 'svn_diagnose'. Calls SvnService.diagnoseCommands(), formats results with status icons, error lists, and hardcoded suggestions, returns markdown text content.
    server.tool(
      "svn_diagnose",
      "Diagnosticar problemas específicos con comandos SVN",
      {},
      async () => {
        try {
          const result = await getSvnService().diagnoseCommands();
          const data = result.data!;
          
          const statusLocalIcon = data.statusLocal ? '✅' : '❌';
          const statusRemoteIcon = data.statusRemote ? '✅' : '❌';
          const logIcon = data.logBasic ? '✅' : '❌';
          
          let diagnosticText = `🔍 **Diagnóstico de Comandos SVN**\n\n` +
            `**Directorio de Trabajo:** ${data.workingCopyPath}\n\n` +
            `${statusLocalIcon} **Status Local:** ${data.statusLocal ? 'Funciona' : 'Falló'}\n` +
            `${statusRemoteIcon} **Status Remoto:** ${data.statusRemote ? 'Funciona' : 'Falló'}\n` +
            `${logIcon} **Log Básico:** ${data.logBasic ? 'Funciona' : 'Falló'}\n`;
          
          if (data.errors.length > 0) {
            diagnosticText += `\n**Errores Detectados:**\n`;
            data.errors.forEach((error, index) => {
              diagnosticText += `${index + 1}. ${error}\n`;
            });
          }
          
          // Añadir sugerencias basadas en los errores
          if (!data.statusRemote || !data.logBasic) {
            diagnosticText += `\n**Posibles Soluciones:**\n`;
            diagnosticText += `• Verificar conexión a internet\n`;
            diagnosticText += `• Verificar credenciales de SVN\n`;
            diagnosticText += `• Ejecutar 'svn cleanup' si hay problemas de lock\n`;
            diagnosticText += `• Verificar que el working copy esté actualizado\n`;
          }
    
          return {
            content: [{ type: "text", text: diagnosticText }],
          };
        } catch (error: any) {
          return {
            content: [{ type: "text", text: `❌ **Error en diagnóstico:** ${error.message}` }],
          };
        }
      }
    );
  • Core logic of svn_diagnose: SvnService.diagnoseCommands() method tests 'svn status', 'svn status --show-updates', and 'svn log --limit 1'. Uses categorizeError helper to classify failures (e.g., no SVN, network, auth) and collects errors/suggestions.
    async diagnoseCommands(): Promise<SvnResponse<{
      statusLocal: boolean;
      statusRemote: boolean;
      logBasic: boolean;
      workingCopyPath: string;
      errors: string[];
      suggestions: string[];
    }>> {
      const results = {
        statusLocal: false,
        statusRemote: false,
        logBasic: false,
        workingCopyPath: this.config.workingDirectory!,
        errors: [] as string[],
        suggestions: [] as string[]
      };
    
      try {
        // Probar svn status local
        try {
          await executeSvnCommand(this.config, ['status']);
          results.statusLocal = true;
        } catch (error: any) {
          const errorMsg = this.categorizeError(error, 'status local');
          results.errors.push(errorMsg.message);
          if (errorMsg.suggestion) {
            results.suggestions.push(errorMsg.suggestion);
          }
        }
    
        // Probar svn status con --show-updates
        try {
          await executeSvnCommand(this.config, ['status', '--show-updates']);
          results.statusRemote = true;
        } catch (error: any) {
          const errorMsg = this.categorizeError(error, 'status remoto');
          results.errors.push(errorMsg.message);
          if (errorMsg.suggestion) {
            results.suggestions.push(errorMsg.suggestion);
          }
        }
    
        // Probar svn log básico
        try {
          await executeSvnCommand(this.config, ['log', '--limit', '1']);
          results.logBasic = true;
        } catch (error: any) {
          const errorMsg = this.categorizeError(error, 'log básico');
          results.errors.push(errorMsg.message);
          if (errorMsg.suggestion) {
            results.suggestions.push(errorMsg.suggestion);
          }
        }
    
        // Agregar sugerencias generales basadas en los resultados
        if (!results.statusRemote && !results.logBasic && results.statusLocal) {
          results.suggestions.push('Los comandos remotos fallan pero el local funciona. Revisa la conectividad de red y credenciales SVN.');
        }
    
        return {
          success: true,
          data: results,
          command: 'diagnostic',
          workingDirectory: this.config.workingDirectory!
        };
    
      } catch (error: any) {
        results.errors.push(`Error general: ${error.message}`);
        return {
          success: false,
          data: results,
          error: error.message,
          command: 'diagnostic',
          workingDirectory: this.config.workingDirectory!
        };
      }
    }
  • Private helper categorizeError used by diagnoseCommands to classify SVN errors (installation, network, auth like E215004/E170001, locks, etc.) and provide specific suggestions.
    private categorizeError(error: any, commandType: string): { message: string; suggestion?: string } {
      const baseMessage = `${commandType} falló`;
      
      // SVN no encontrado en el sistema
      if ((error.message.includes('spawn') && error.message.includes('ENOENT')) ||
          error.code === 127) {
        return {
          message: `${baseMessage}: SVN no está instalado o no se encuentra en el PATH`,
          suggestion: 'Instala SVN (subversion) o verifica que esté en el PATH del sistema'
        };
      }
      
      // Errores de conectividad
      if (error.message.includes('E175002') || 
          error.message.includes('Unable to connect') ||
          error.message.includes('Connection refused') ||
          error.message.includes('Network is unreachable')) {
        return {
          message: `${baseMessage}: Sin conectividad al servidor SVN`,
          suggestion: 'Verifica tu conexión a internet y que el servidor SVN esté accesible'
        };
      }
      
      // Errores de autenticación - demasiados intentos
      if (error.message.includes('E215004') || 
          error.message.includes('No more credentials') ||
          error.message.includes('we tried too many times')) {
        return {
          message: `${baseMessage}: Demasiados intentos de autenticación fallidos`,
          suggestion: 'Las credenciales pueden estar incorrectas o cachadas. Limpia el cache de credenciales SVN y verifica SVN_USERNAME y SVN_PASSWORD'
        };
      }
      
      // Errores de autenticación generales
      if (error.message.includes('E170001') || 
          error.message.includes('Authentication failed') ||
          error.message.includes('authorization failed')) {
        return {
          message: `${baseMessage}: Error de autenticación`,
          suggestion: 'Verifica tus credenciales SVN (SVN_USERNAME y SVN_PASSWORD)'
        };
      }
      
      // Working copy no válido
      if (error.message.includes('E155007') || 
          error.message.includes('not a working copy')) {
        return {
          message: `${baseMessage}: No es un working copy válido`,
          suggestion: 'Asegúrate de estar en un directorio con checkout de SVN o ejecuta svn checkout primero'
        };
      }
      
      // Working copy bloqueado
      if (error.message.includes('E155036') || 
          error.message.includes('working copy locked')) {
        return {
          message: `${baseMessage}: Working copy bloqueado`,
          suggestion: 'Ejecuta "svn cleanup" para desbloquear el working copy'
        };
      }
      
      // Error genérico con código 1 (frecuente en comandos remotos)
      if (error.code === 1) {
        return {
          message: `${baseMessage}: Comando falló con código 1 (posible problema de red/autenticación)`,
          suggestion: 'Revisa conectividad de red, credenciales SVN, y que el repositorio sea accesible'
        };
      }
      
      // Error genérico
      return {
        message: `${baseMessage}: ${error.message}`,
        suggestion: undefined
      };
    }
  • index.ts:69-72 (registration)
    Tool registration call: server.tool('svn_diagnose', description, empty schema).
    "svn_diagnose",
    "Diagnosticar problemas específicos con comandos SVN",
    {},
    async () => {
Behavior2/5

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

With no annotations, the description carries full burden but only states it diagnoses problems without detailing behavioral traits like what it inspects (e.g., logs, configurations), whether it's safe or destructive, or what output to expect. It adds minimal context beyond the basic purpose.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence in Spanish that directly states the tool's purpose without unnecessary words. It's appropriately sized for a no-parameter tool, though it could be more front-loaded with specifics.

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 diagnostic tool with no annotations, no output schema, and 0 parameters, the description is incomplete. It doesn't explain what problems it diagnoses, how it works, or what results to expect, leaving significant gaps for an AI agent to understand its use.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add param info, but that's acceptable here. Baseline is 4 for zero parameters, as the schema fully covers the absence of inputs.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Diagnosticar problemas específicos con comandos SVN' states a general purpose (diagnose SVN command problems) but lacks specificity about what kind of problems or how it differs from sibling tools like 'svn_health_check'. It's not tautological but remains vague about the exact scope.

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?

No guidance is provided on when to use this tool versus alternatives like 'svn_health_check' or other diagnostic methods. The description implies usage for SVN command issues but doesn't specify contexts, prerequisites, or exclusions.

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/gcorroto/mcp-svn'

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