list_files
Retrieve all files within an Overleaf project, optionally filtered by file extension. Specify project name or ID to access and manage project content efficiently via Git integration.
Instructions
List all files in an Overleaf project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| extension | No | File extension filter (e.g., .tex) | .tex |
| gitToken | No | Git token (optional, uses env var) | |
| projectId | No | Project ID (optional, uses env var) | |
| projectName | No | Project name (default, project2, etc.) |
Implementation Reference
- overleaf-mcp-server.js:260-271 (handler)Handler logic for the 'list_files' tool that retrieves the project client and lists files filtered by extension.case 'list_files': { const client = getProject(args.projectName); const files = await client.listFiles(args.extension || '.tex'); return { content: [ { type: 'text', text: files.join('\n'), }, ], }; }
- overleaf-mcp-server.js:146-162 (registration)Tool registration entry listing the 'list_files' tool with description and input schema in the MCP server's tool list.{ name: 'list_files', description: 'List files in an Overleaf project', inputSchema: { type: 'object', properties: { projectName: { type: 'string', description: 'Project identifier (optional, defaults to "default")', }, extension: { type: 'string', description: 'File extension filter (optional, e.g., ".tex")', }, }, }, },
- overleaf-mcp-server.js:149-161 (schema)Input schema defining parameters for the 'list_files' tool: optional projectName and extension.inputSchema: { type: 'object', properties: { projectName: { type: 'string', description: 'Project identifier (optional, defaults to "default")', }, extension: { type: 'string', description: 'File extension filter (optional, e.g., ".tex")', }, }, },
- overleaf-mcp-server.js:61-70 (helper)Implementation of listFiles method in OverleafGitClient class that clones/pulls the repository and uses 'find' command to list matching files.async listFiles(extension = '.tex') { await this.cloneOrPull(); const { stdout } = await exec( `find "${this.repoPath}" -name "*${extension}" -type f` ); return stdout .split('\n') .filter(f => f) .map(f => f.replace(this.repoPath + '/', '')); }
- overleaf-mcp-server.js:126-132 (helper)Helper function to create an OverleafGitClient instance for a given project name from configuration.function getProject(projectName = 'default') { const project = projectsConfig.projects[projectName]; if (!project) { throw new Error(`Project "${projectName}" not found in configuration`); } return new OverleafGitClient(project.projectId, project.gitToken); }