Skip to main content
Glama

read_file

Access and retrieve specific files from Overleaf projects by providing the file path and project details. Enables reading LaTeX files, analyzing document structure, and extracting content via Git integration.

Instructions

Read a file from an Overleaf project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesPath to the file
gitTokenNoGit token (optional, uses env var)
projectIdNoProject ID (optional, uses env var)
projectNameNoProject name (default, project2, etc.)

Implementation Reference

  • Executes the 'read_file' tool logic: creates an OverleafGitClient instance and invokes its readFile method to fetch and return the file contents as text response.
    case 'read_file': { const client = getProject(args.projectName); const content = await client.readFile(args.filePath); return { content: [ { type: 'text', text: content, }, ], }; }
  • Defines the input schema for the 'read_file' tool, specifying required 'filePath' and optional 'projectName' parameters.
    inputSchema: { type: 'object', properties: { filePath: { type: 'string', description: 'Path to the file', }, projectName: { type: 'string', description: 'Project identifier (optional)', }, }, required: ['filePath'], },
  • Registers the 'read_file' tool in the listTools response, providing name, description, and input schema.
    { name: 'read_file', description: 'Read a file from an Overleaf project', inputSchema: { type: 'object', properties: { filePath: { type: 'string', description: 'Path to the file', }, projectName: { type: 'string', description: 'Project identifier (optional)', }, }, required: ['filePath'], }, },
  • OverleafGitClient.readFile helper method that ensures the repository is up-to-date via cloneOrPull and reads the file content using Node.js fs.readFile.
    async readFile(filePath) { await this.cloneOrPull(); const fullPath = path.join(this.repoPath, filePath); return await readFile(fullPath, 'utf-8'); }

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