Skip to main content
Glama
gcorroto

SVN MCP Server

by gcorroto

svn_log

Retrieve commit history from SVN repositories by specifying paths, revision ranges, or limiting entries to analyze project changes.

Instructions

Ver historial de commits del repositorio

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoRuta específica
limitNoNúmero máximo de entradas
revisionNoRevisión específica o rango (ej: 100:200)

Implementation Reference

  • Core handler implementation for 'svn_log' tool: constructs 'svn log' command with optional path, limit, revision; executes via executeSvnCommand; parses output with parseLogOutput into SvnLogEntry[]; handles specific errors.
    /**
     * Obtener historial de cambios (log)
     */
    async getLog(
      path?: string, 
      limit?: number, 
      revision?: string
    ): Promise<SvnResponse<SvnLogEntry[]>> {
      try {
        const args = ['log'];
        
        if (limit && limit > 0) {
          args.push('--limit', limit.toString());
        }
        
        if (revision) {
          args.push('--revision', revision);
        }
        
        if (path) {
          if (!validatePath(path)) {
            throw new SvnError(`Invalid path: ${path}`);
          }
          args.push(normalizePath(path));
        }
    
        let response;
        try {
          response = await executeSvnCommand(this.config, args);
        } catch (error: any) {
          // Detectar si SVN no está instalado
          if ((error.message.includes('spawn') && error.message.includes('ENOENT')) ||
              error.code === 127) {
            const enhancedError = new SvnError(
              'SVN no está instalado o no se encuentra en el PATH del sistema. Instala Subversion para usar este comando.'
            );
            enhancedError.command = error.command;
            enhancedError.code = error.code;
            throw enhancedError;
          }
          
          // Detectar errores de red/conectividad y proporcionar mensajes más útiles
          if (error.message.includes('E175002') || 
              error.message.includes('Unable to connect') ||
              error.message.includes('Connection refused') ||
              error.message.includes('Network is unreachable') ||
              error.code === 1) {
            
            // Intentar con opciones que funcionen sin conectividad remota si es posible
            console.warn(`Log remoto falló, posible problema de conectividad: ${error.message}`);
            
            // Para comandos log, podemos intentar usar --offline si está disponible, 
            // o proporcionar una respuesta vacía con información útil
            const enhancedError = new SvnError(
              `No se pudo obtener el historial de cambios. Posibles causas:
              - Sin conectividad al servidor SVN
              - Credenciales requeridas pero no proporcionadas
              - Servidor SVN temporalmente inaccesible
              - Working copy no sincronizado con el repositorio remoto`
            );
            enhancedError.command = error.command;
            enhancedError.stderr = error.stderr;
            enhancedError.code = error.code;
            throw enhancedError;
          }
          // Re-lanzar otros errores sin modificar
          throw error;
        }
    
        const logEntries = parseLogOutput(cleanOutput(response.data as string));
    
        return {
          success: true,
          data: logEntries,
          command: response.command,
          workingDirectory: response.workingDirectory,
          executionTime: response.executionTime
        };
    
      } catch (error: any) {
        this.handleSvnError(error, 'get SVN log');
      }
    }
  • index.ts:204-242 (registration)
    MCP server registration of 'svn_log' tool: defines name, description, Zod input schema (path, limit, revision), and async handler that delegates to SvnService.getLog and formats Markdown response.
    server.tool(
      "svn_log",
      "Ver historial de commits del repositorio",
      {
        path: z.string().optional().describe("Ruta específica"),
        limit: z.number().optional().default(10).describe("Número máximo de entradas"),
        revision: z.string().optional().describe("Revisión específica o rango (ej: 100:200)")
      },
      async (args) => {
        try {
          const result = await getSvnService().getLog(args.path, args.limit, args.revision);
          const logEntries = result.data!;
          
          if (logEntries.length === 0) {
            return {
              content: [{ type: "text", text: "📝 **No se encontraron entradas en el log**" }],
            };
          }
    
          const logText = `📚 **Historial SVN** (${logEntries.length} entradas)\n\n` +
            logEntries.map((entry, index) => 
              `**${index + 1}. Revisión ${entry.revision}**\n` +
              `👤 **Autor:** ${entry.author}\n` +
              `📅 **Fecha:** ${entry.date}\n` +
              `💬 **Mensaje:** ${entry.message || 'Sin mensaje'}\n` +
              `---`
            ).join('\n\n') +
            `\n**Tiempo de Ejecución:** ${formatDuration(result.executionTime || 0)}`;
    
          return {
            content: [{ type: "text", text: logText }],
          };
        } catch (error: any) {
          return {
            content: [{ type: "text", text: `❌ **Error:** ${error.message}` }],
          };
        }
      }
    );
  • TypeScript interface defining the structure of SVN log entries returned by the tool.
    export interface SvnLogEntry {
      revision: number;
      author: string;
      date: string;
      message: string;
      changedPaths?: SvnChangedPath[];
    }
  • Utility function to parse raw 'svn log' command output into array of structured SvnLogEntry objects.
    export function parseLogOutput(output: string): SvnLogEntry[] {
      const entries: SvnLogEntry[] = [];
      
      if (!output || output.trim().length === 0) {
        return entries;
      }
      
      // Dividir por las líneas separadoras de SVN log
      const logEntries = output.split(/^-{72}$/gm).filter(entry => entry.trim());
      
      for (const entryText of logEntries) {
        const lines = entryText.trim().split('\n');
        if (lines.length < 2) continue;
        
        const headerLine = lines[0];
        // Patrón más flexible para el header
        const headerMatch = headerLine.match(/^r(\d+)\s*\|\s*([^|]+?)\s*\|\s*([^|]+?)\s*\|\s*(.*)$/);
        
        if (headerMatch) {
          try {
            const [, revision, author, date, details] = headerMatch;
            const message = lines.slice(2).join('\n').trim();
            
            entries.push({
              revision: parseInt(revision, 10),
              author: author.trim(),
              date: date.trim(),
              message: message || 'Sin mensaje'
            });
          } catch (parseError) {
            console.warn(`Warning: Failed to parse log entry: ${parseError}`);
            continue;
          }
        }
      }
      
      return entries;
    }
  • Zod input schema for 'svn_log' tool parameters.
    {
      path: z.string().optional().describe("Ruta específica"),
      limit: z.number().optional().default(10).describe("Número máximo de entradas"),
      revision: z.string().optional().describe("Revisión específica o rango (ej: 100:200)")
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'ver historial' implies a read-only operation, the description doesn't disclose important behavioral aspects like whether this requires authentication, what format the output takes, whether it shows all branches or just trunk, or any rate limits. For a tool with 3 parameters and no annotation coverage, this is insufficient.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It's appropriately sized for a straightforward tool and front-loads the core functionality. Every word earns its place.

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?

Given that this is a 3-parameter tool with no annotations and no output schema, the description is inadequate. It doesn't explain what the output looks like (list of commits? detailed information per commit?), doesn't mention authentication requirements, and provides no context about typical use cases. For a tool that likely returns structured historical data, more completeness is needed.

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

Parameters3/5

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

With 100% schema description coverage, all parameters are already documented in the input schema. The description doesn't add any additional semantic context about the parameters beyond what's in the schema descriptions. The baseline score of 3 is appropriate since the schema does the heavy lifting, but the description doesn't enhance understanding of how parameters interact or typical usage patterns.

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

Purpose4/5

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

The description 'Ver historial de commits del repositorio' clearly states the tool's purpose as viewing commit history in a repository. It uses a specific verb ('ver' - view) and resource ('historial de commits'), but doesn't differentiate from sibling tools like 'svn_info' which might also provide historical information. The description is in Spanish, which matches the parameter descriptions.

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?

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools like 'svn_info', 'svn_status', and 'svn_diff' that might provide related information, there's no indication of when this specific log viewing tool is appropriate versus other options.

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