mover_archivo
Move or rename files by specifying source and destination paths to organize your file system.
Instructions
Mueve o renombra un archivo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| origen | Yes | Ruta/nombre del archivo origen | |
| destino | Yes | Ruta/nombre del archivo destino |
Implementation Reference
- main.ts:256-284 (handler)The switch case handler for 'mover_archivo' that parses arguments using the schema, validates paths restricted to desktop, creates destination directory if needed, renames the file using fs.rename, and returns success or error message.case "mover_archivo": { const { origen, destino } = MoverArchivoSchema.parse(args); const rutaOrigen = path.join(DESKTOP_DIR, origen); const rutaDestino = path.join(DESKTOP_DIR, destino); if (!validarRuta(rutaOrigen) || !validarRuta(rutaDestino)) { return { content: [ { type: "text", text: "Error: Solo se permite acceso al escritorio", }, ], isError: true, }; } await fs.mkdir(path.dirname(rutaDestino), { recursive: true }); await fs.rename(rutaOrigen, rutaDestino); return { content: [ { type: "text", text: `Archivo movido o renombrado: ${origen} a ${destino}`, }, ], }; }
- main.ts:57-60 (schema)Zod schema defining input parameters 'origen' and 'destino' for the mover_archivo tool.const MoverArchivoSchema = z.object({ origen: z.string().describe("Ruta/nombre del archivo origen"), destino: z.string().describe("Ruta/nombre del archivo destino"), });
- main.ts:120-137 (registration)Tool registration in the ListTools response, including name, description, and inputSchema matching the Zod schema.{ name: "mover_archivo", description: "Mueve o renombra un archivo", inputSchema: { type: "object", properties: { origen: { type: "string", description: "Ruta/nombre del archivo origen", }, destino: { type: "string", description: "Ruta/nombre del archivo destino", }, }, required: ["origen", "destino"], }, },