Skip to main content
Glama

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; }

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