Skip to main content
Glama
gcorroto

SVN MCP Server

by gcorroto

svn_add

Add files or directories to SVN version control to track changes and manage repository content.

Instructions

Añadir archivos al control de versiones

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathsYesArchivo(s) o directorio(s) a añadir
forceNoForzar adición
noIgnoreNoNo respetar reglas de ignore
parentsNoCrear directorios padre si es necesario
autoPropsNoAplicar auto-propiedades
noAutoPropsNoNo aplicar auto-propiedades

Implementation Reference

  • index.ts:361-400 (registration)
    MCP server.tool registration for 'svn_add', including zod input schema, description, and thin handler wrapper that calls SvnService.add() and formats response.
    server.tool(
      "svn_add",
      "Añadir archivos al control de versiones",
      {
        paths: z.union([z.string(), z.array(z.string())]).describe("Archivo(s) o directorio(s) a añadir"),
        force: z.boolean().optional().default(false).describe("Forzar adición"),
        noIgnore: z.boolean().optional().default(false).describe("No respetar reglas de ignore"),
        parents: z.boolean().optional().default(false).describe("Crear directorios padre si es necesario"),
        autoProps: z.boolean().optional().describe("Aplicar auto-propiedades"),
        noAutoProps: z.boolean().optional().describe("No aplicar auto-propiedades")
      },
      async (args) => {
        try {
          const options = {
            force: args.force,
            noIgnore: args.noIgnore,
            parents: args.parents,
            autoProps: args.autoProps,
            noAutoProps: args.noAutoProps
          };
          
          const result = await getSvnService().add(args.paths, options);
          const pathsArray = Array.isArray(args.paths) ? args.paths : [args.paths];
          
          const addText = `➕ **Archivos Añadidos**\n\n` +
            `**Archivos:** ${pathsArray.join(', ')}\n` +
            `**Comando:** ${result.command}\n` +
            `**Tiempo de Ejecución:** ${formatDuration(result.executionTime || 0)}\n\n` +
            `**Resultado:**\n\`\`\`\n${result.data}\n\`\`\``;
    
          return {
            content: [{ type: "text", text: addText }],
          };
        } catch (error: any) {
          return {
            content: [{ type: "text", text: `❌ **Error:** ${error.message}` }],
          };
        }
      }
    );
  • Core handler logic in SvnService.add() method: validates paths, builds 'svn add' command arguments based on options, executes via executeSvnCommand, and returns formatted response.
    async add(
      paths: string | string[],
      options: SvnAddOptions = {}
    ): Promise<SvnResponse<string>> {
      try {
        const pathArray = Array.isArray(paths) ? paths : [paths];
        
        // Validar todas las rutas
        for (const path of pathArray) {
          if (!validatePath(path)) {
            throw new SvnError(`Invalid path: ${path}`);
          }
        }
    
        const args = ['add'];
        
        if (options.force) {
          args.push('--force');
        }
        
        if (options.noIgnore) {
          args.push('--no-ignore');
        }
        
        if (options.autoProps) {
          args.push('--auto-props');
        }
        
        if (options.noAutoProps) {
          args.push('--no-auto-props');
        }
        
        if (options.parents) {
          args.push('--parents');
        }
    
        // Añadir rutas normalizadas
        args.push(...pathArray.map(p => normalizePath(p)));
    
        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 add files: ${error.message}`);
      }
    }
  • TypeScript interface SvnAddOptions defining the options structure for the svn add operation, imported and used in SvnService.add().
    export interface SvnAddOptions {
      force?: boolean;
      noIgnore?: boolean;
      autoProps?: boolean;
      noAutoProps?: boolean;
      parents?: boolean;
    }

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