Skip to main content
Glama
gcorroto

SVN MCP Server

by gcorroto

svn_diff

Compare file changes between SVN revisions to identify modifications, additions, or deletions in repository content.

Instructions

Ver diferencias entre versiones de archivos

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoRuta específica
oldRevisionNoRevisión antigua
newRevisionNoRevisión nueva

Implementation Reference

  • MCP tool handler function that executes svn_diff by calling SvnService.getDiff and formatting the raw diff output as markdown code block.
    async (args) => {
      try {
        const result = await getSvnService().getDiff(args.path, args.oldRevision, args.newRevision);
        const diffOutput = result.data!;
        
        if (!diffOutput || diffOutput.trim().length === 0) {
          return {
            content: [{ type: "text", text: "✅ **No hay diferencias encontradas**" }],
          };
        }
    
        const diffText = `🔍 **Diferencias SVN**\n\n` +
          `**Comando:** ${result.command}\n` +
          `**Tiempo de Ejecución:** ${formatDuration(result.executionTime || 0)}\n\n` +
          `\`\`\`diff\n${diffOutput}\n\`\`\``;
    
        return {
          content: [{ type: "text", text: diffText }],
        };
      } catch (error: any) {
        return {
          content: [{ type: "text", text: `❌ **Error:** ${error.message}` }],
        };
      }
    }
  • Zod input schema defining optional parameters: path, oldRevision, newRevision for the svn_diff tool.
    {
      path: z.string().optional().describe("Ruta específica"),
      oldRevision: z.string().optional().describe("Revisión antigua"),
      newRevision: z.string().optional().describe("Revisión nueva")
    },
  • index.ts:245-278 (registration)
    Registration of the svn_diff tool using McpServer.tool() including name, description, schema, and handler reference.
    server.tool(
      "svn_diff",
      "Ver diferencias entre versiones de archivos",
      {
        path: z.string().optional().describe("Ruta específica"),
        oldRevision: z.string().optional().describe("Revisión antigua"),
        newRevision: z.string().optional().describe("Revisión nueva")
      },
      async (args) => {
        try {
          const result = await getSvnService().getDiff(args.path, args.oldRevision, args.newRevision);
          const diffOutput = result.data!;
          
          if (!diffOutput || diffOutput.trim().length === 0) {
            return {
              content: [{ type: "text", text: "✅ **No hay diferencias encontradas**" }],
            };
          }
    
          const diffText = `🔍 **Diferencias SVN**\n\n` +
            `**Comando:** ${result.command}\n` +
            `**Tiempo de Ejecución:** ${formatDuration(result.executionTime || 0)}\n\n` +
            `\`\`\`diff\n${diffOutput}\n\`\`\``;
    
          return {
            content: [{ type: "text", text: diffText }],
          };
        } catch (error: any) {
          return {
            content: [{ type: "text", text: `❌ **Error:** ${error.message}` }],
          };
        }
      }
    );
  • SvnService.getDiff method: constructs 'svn diff' command arguments based on parameters and executes it using executeSvnCommand utility.
    async getDiff(
      path?: string,
      oldRevision?: string,
      newRevision?: string
    ): Promise<SvnResponse<string>> {
      try {
        const args = ['diff'];
        
        if (oldRevision && newRevision) {
          args.push('--old', `${path || '.'}@${oldRevision}`);
          args.push('--new', `${path || '.'}@${newRevision}`);
        } else if (oldRevision) {
          args.push('--revision', oldRevision);
          if (path) {
            args.push(normalizePath(path));
          }
        } else if (path) {
          if (!validatePath(path)) {
            throw new SvnError(`Invalid path: ${path}`);
          }
          args.push(normalizePath(path));
        }
    
        const response = await executeSvnCommand(this.config, args);
    
        return {
          success: true,
          data: cleanOutput(response.data as string),
          command: response.command,
          workingDirectory: response.workingDirectory,
          executionTime: response.executionTime
        };
    
      } catch (error: any) {
        throw new SvnError(`Failed to get SVN diff: ${error.message}`);
      }
    }
  • TypeScript interfaces defining structured SvnDiff, SvnDiffHunk, and SvnDiffLine for parsed diff output (not used in current raw string implementation).
    export interface SvnDiff {
      oldPath: string;
      newPath: string;
      oldRevision?: number;
      newRevision?: number;
      hunks: SvnDiffHunk[];
    }
    
    export interface SvnDiffHunk {
      oldStart: number;
      oldCount: number;
      newStart: number;
      newCount: number;
      lines: SvnDiffLine[];
    }
    
    export interface SvnDiffLine {
      type: 'context' | 'added' | 'deleted';
      content: string;
      oldLineNumber?: number;
      newLineNumber?: number;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Ver diferencias' implies a read-only operation, it doesn't specify whether this requires authentication, what format the diff output takes (unified diff, side-by-side, etc.), whether it shows changes for entire directories or just files, or any rate limits. The description is too minimal for a tool with behavioral implications.

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 in Spanish that directly states the tool's purpose. There's no wasted language or unnecessary elaboration - every word contributes to understanding what the tool does.

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 version control diff tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the output looks like (text diff format), whether it handles binary files, what happens when revisions aren't specified, or any error conditions. The minimal description leaves too many behavioral questions unanswered.

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?

The schema description coverage is 100%, with all three parameters ('path', 'oldRevision', 'newRevision') clearly documented in the schema. The description doesn't add any parameter-specific information beyond what's already in the schema, so it meets the baseline for when schema coverage is high.

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 clearly states the verb ('Ver diferencias' - View differences) and resource ('entre versiones de archivos' - between file versions), making the purpose immediately understandable. It doesn't specifically differentiate from sibling tools like 'svn_log' or 'svn_status' which might also show version information, but the core function is well-defined.

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. It doesn't mention when this tool is appropriate compared to 'svn_log' (which shows commit history) or 'svn_status' (which shows working copy status), nor does it specify any prerequisites or constraints for usage.

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