leer_archivo
Read the content of an existing file in the DedcodeMCP File Manager to access stored information for processing or analysis.
Instructions
Lee el contenido de un archivo existente
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nombre | Yes | Nombre del archivo a leer |
Implementation Reference
- main.ts:199-225 (handler)Handler function for leer_archivo tool: parses args with schema, validates path, reads file from desktop using fs.readFile, returns content.case "leer_archivo": { const { nombre } = LeerArchivoSchema.parse(args); const ruta = path.join(DESKTOP_DIR, nombre); if (!validarRuta(ruta)) { return { content: [ { type: "text", text: "Error: Solo se permite acceso al escritorio", }, ], isError: true, }; } const contenido = await fs.readFile(ruta, "utf-8"); return { content: [ { type: "text", text: `Contenido de ${nombre}:\n\n${contenido}`, }, ], }; }
- main.ts:48-50 (schema)Zod schema for leer_archivo input validation: requires 'nombre' string.const LeerArchivoSchema = z.object({ nombre: z.string().describe("Nombre del archivo a leer"), });
- main.ts:88-100 (registration)Tool registration in ListToolsResponse: defines name, description, and inputSchema for leer_archivo.{ name: "leer_archivo", description: "Lee el contenido de un archivo existente", inputSchema: { type: "object", properties: { nombre: { type: "string", description: "Nombre del archivo a leer", }, }, required: ["nombre"], },