Skip to main content
Glama

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
NameRequiredDescriptionDefault
extensionNoFile extension filter (e.g., .tex).tex
gitTokenNoGit token (optional, uses env var)
projectIdNoProject ID (optional, uses env var)
projectNameNoProject name (default, project2, etc.)

Implementation Reference

  • 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'), }, ], }; }
  • 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")', }, }, }, },
  • 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")', }, }, },
  • 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 + '/', '')); }
  • 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); }

Other Tools

Related Tools

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/mjyoo2/OverleafMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server