parse_cv_pdf
Extract text and structure from CV PDF files to enable automated resume building and updates with LaTeX formatting support.
Instructions
Parse an existing CV PDF file to extract text content and structure
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pdfPath | Yes | Relative or absolute path to the CV PDF file |
Implementation Reference
- The core handler function for the 'parse_cv_pdf' tool. It resolves the PDF file path, uses pypdf to extract text from all pages, formats the output with metadata, and returns it as TextContent.async def parse_cv_pdf(pdf_path: Optional[str]) -> list[TextContent]: """Parse a PDF CV file.""" if not pdf_path: return [TextContent(type="text", text="Error: pdfPath parameter is required")] # Resolve path if pdf_path.startswith('/'): resolved_path = Path(pdf_path) else: resolved_path = Path(REPO_PATH) / pdf_path if not resolved_path.exists(): return [TextContent(type="text", text=f"PDF file not found: {resolved_path}")] try: # Parse PDF reader = pypdf.PdfReader(str(resolved_path)) text = "" for page in reader.pages: text += page.extract_text() + "\n" output = f"""PDF CV Parsed Successfully: File: {pdf_path} Pages: {len(reader.pages)} pages Text Length: {len(text)} characters --- EXTRACTED CONTENT --- {text} --- END OF CONTENT --- This content can now be used to generate an enhanced CV with recent work data.""" return [TextContent(type="text", text=output)] except Exception as e: return [TextContent(type="text", text=f"PDF parsing error: {str(e)}")]
- src/cv_resume_builder_mcp/server.py:268-281 (registration)Registration of the 'parse_cv_pdf' tool in the @app.list_tools() handler, defining its name, description, and input schema.Tool( name="parse_cv_pdf", description="Parse an existing CV PDF file to extract text content and structure", inputSchema={ "type": "object", "properties": { "pdfPath": { "type": "string", "description": "Relative or absolute path to the CV PDF file" } }, "required": ["pdfPath"] } ),
- Input schema for the 'parse_cv_pdf' tool, specifying the required 'pdfPath' parameter.inputSchema={ "type": "object", "properties": { "pdfPath": { "type": "string", "description": "Relative or absolute path to the CV PDF file" } }, "required": ["pdfPath"] }
- src/cv_resume_builder_mcp/server.py:359-360 (registration)Dispatch routing in the main @app.call_tool() handler that invokes the parse_cv_pdf function when the tool name matches.elif name == "parse_cv_pdf": return await parse_cv_pdf(arguments.get("pdfPath"))