Skip to main content
Glama

compile_resume

Compile LaTeX resume files to PDF format using pdflatex, generating professional documents from source files with specified output directory options.

Instructions

Compile a LaTeX resume to PDF using pdflatex. Args: filename: Name of the resume file to compile output_dir: Output directory for the PDF (default: same as resumes directory) Returns the path to the generated PDF or compilation errors.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYes
output_dirNo

Implementation Reference

  • The core handler function for the 'compile_resume' tool. It is registered via the @mcp.tool() decorator, which also serves as the registration point. The function compiles a LaTeX resume file (.tex) to PDF using pdflatex, handling directory setup, executable detection, subprocess execution (run twice for references), cleanup of aux files, and returns JSON with success/error details including PDF path.
    @mcp.tool() def compile_resume(filename: str, output_dir: str = None) -> str: """ Compile a LaTeX resume to PDF using pdflatex. Args: filename: Name of the resume file to compile output_dir: Output directory for the PDF (default: same as resumes directory) Returns the path to the generated PDF or compilation errors. """ ensure_dirs() resumes_dir = get_resumes_dir() filepath = resumes_dir / ensure_tex_extension(filename) if not filepath.exists(): return json.dumps({"error": f"Resume '{filename}' not found"}) pdflatex_cmd = find_pdflatex() if not pdflatex_cmd: return json.dumps({ "error": "pdflatex not found. Please install LaTeX:", "install_instructions": { "macOS": "brew install --cask mactex # or: brew install --cask basictex", "Ubuntu/Debian": "sudo apt install texlive-latex-base texlive-latex-extra", "Fedora": "sudo dnf install texlive-scheme-basic", "Windows": "Download from https://miktex.org/" } }) out_dir = Path(output_dir) if output_dir else resumes_dir out_dir.mkdir(parents=True, exist_ok=True) try: # Run pdflatex twice for proper reference resolution for _ in range(2): result = subprocess.run( [pdflatex_cmd, "-interaction=nonstopmode", f"-output-directory={out_dir}", filepath.name], cwd=resumes_dir, capture_output=True, text=True, timeout=60 ) pdf_name = filepath.stem + ".pdf" pdf_path = out_dir / pdf_name if pdf_path.exists(): # Clean up auxiliary files for ext in [".aux", ".log", ".out"]: aux_file = out_dir / (filepath.stem + ext) if aux_file.exists(): aux_file.unlink() return json.dumps({ "success": True, "pdf_path": str(pdf_path), "message": f"Successfully compiled {filename} to PDF" }) else: return json.dumps({ "error": "Compilation failed", "stdout": result.stdout[-2000:] if result.stdout else "", "stderr": result.stderr[-2000:] if result.stderr else "" }) except subprocess.TimeoutExpired: return json.dumps({"error": "Compilation timed out after 60 seconds"}) except Exception as e: return json.dumps({"error": f"Compilation error: {str(e)}"})

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/dannywillowliu-uchi/resume_mcp'

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