Skip to main content
Glama

clone_project

Clone an Overleaf project to a local directory for offline editing and version control. Specify project ID and local path to download LaTeX files.

Instructions

Clone an Overleaf project to a local directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesThe ID of the Overleaf project
localPathYesThe local path to clone the project to (absolute path)
emailNoOverleaf account email (optional if configured globally)
tokenNoOverleaf git token (optional if configured globally)

Implementation Reference

  • Core handler function that performs the git clone of an Overleaf project, handling authentication and directory setup.
    async cloneProject(projectId: string, localPath: string, email?: string, token?: string) {
        // Ensure parent directory exists
        await fs.ensureDir(path.dirname(localPath));
    
        let gitUrl = '';
    
        // Try to get credentials if not provided
        if (!email || !token) {
            const creds = await this.authManager.getCredentials();
            if (creds) {
                gitUrl = this.getGitUrl(projectId, creds.email, creds.token);
            } else {
                // Fallback to no-auth URL (will likely fail or prompt if interactive, but MCP is non-interactive)
                // Ideally we should error here if no auth is available for a private repo, 
                // but let's try to construct it.
                gitUrl = this.getGitUrl(projectId);
            }
        } else {
            gitUrl = this.getGitUrl(projectId, email, token);
        }
    
        const git: SimpleGit = simpleGit();
        try {
            await git.clone(gitUrl, localPath);
            console.error(`Successfully cloned project ${projectId} to ${localPath}`);
            return { success: true, message: `Cloned to ${localPath}` };
        } catch (error: any) {
            console.error('Clone failed:', error);
            throw new Error(`Failed to clone project: ${error.message}`);
        }
    }
  • Input schema defining parameters for the clone_project tool: projectId (required), localPath (required), email (optional), token (optional).
    inputSchema: {
        type: 'object',
        properties: {
            projectId: {
                type: 'string',
                description: 'The ID of the Overleaf project',
            },
            localPath: {
                type: 'string',
                description: 'The local path to clone the project to (absolute path)',
            },
            email: {
                type: 'string',
                description: 'Overleaf account email (optional if configured globally)',
            },
            token: {
                type: 'string',
                description: 'Overleaf git token (optional if configured globally)',
            },
        },
        required: ['projectId', 'localPath'],
    },
  • src/index.ts:32-57 (registration)
    Registration of the clone_project tool in the list of tools returned by ListToolsRequestHandler, including name, description, and schema.
    {
        name: 'clone_project',
        description: 'Clone an Overleaf project to a local directory',
        inputSchema: {
            type: 'object',
            properties: {
                projectId: {
                    type: 'string',
                    description: 'The ID of the Overleaf project',
                },
                localPath: {
                    type: 'string',
                    description: 'The local path to clone the project to (absolute path)',
                },
                email: {
                    type: 'string',
                    description: 'Overleaf account email (optional if configured globally)',
                },
                token: {
                    type: 'string',
                    description: 'Overleaf git token (optional if configured globally)',
                },
            },
            required: ['projectId', 'localPath'],
        },
    },
  • Dispatcher handler in CallToolRequestHandler that extracts arguments and calls gitManager.cloneProject.
    case 'clone_project': {
        const { projectId, localPath, email, token } = request.params.arguments as any;
        const result = await gitManager.cloneProject(projectId, localPath, email, token);
        return {
            content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
        };
    }
  • Helper function to construct the git clone URL with embedded credentials if provided.
    private getGitUrl(projectId: string, email?: string, token?: string): string {
        // If credentials are provided directly, use them
        if (email && token) {
            // Encode email to handle special characters like '@'
            const encodedEmail = encodeURIComponent(email);
            return `https://${encodedEmail}:${token}@git.overleaf.com/${projectId}`;
        }
        return `https://git.overleaf.com/${projectId}`;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden but only states the basic action without disclosing behavioral traits. It doesn't mention permissions needed, whether it overwrites existing files, error handling, or any side effects, which is a significant gap for a tool that likely involves file system operations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with zero waste. It's front-loaded with the core action and resource, making it highly efficient and easy to parse, which is ideal for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of cloning a project (involving authentication and file operations), no annotations, and no output schema, the description is incomplete. It lacks details on success/failure outcomes, error cases, or interaction with sibling tools, leaving gaps for the agent to infer behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the schema already documents all parameters well. The description adds no additional meaning beyond implying the tool uses 'projectId' and 'localPath', but it doesn't compensate with extra context like format examples or constraints, meeting the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('clone') and resource ('Overleaf project') with the destination ('to a local directory'). It's specific about what the tool does, though it doesn't explicitly differentiate from sibling tools like 'pull_changes' or 'configure_auth', which keeps it from a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'pull_changes' or 'configure_auth'. The description lacks context about prerequisites or scenarios, such as whether this is for initial setup or ongoing sync, leaving the agent without usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/juho127/overleafMCP'

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