Large PDFs cannot be consumed by Claude Desktop #5

Closed
opened 2026-04-17 12:10:47 -05:00 by Peter.Morton · 0 comments
Owner

Reading large PDFs from Obsidian results in the following error in Claude:

"Output too large (26.3MB). Full output saved to: /sessions/blissful-loving-ramanujan/mnt/.claude/projects/-sessions-blissful-loving-ramanujan/b4356531-59f8-4e81-b961-78bd891c750e/tool-results/toolu_018NNa4YyBeRLXSSEgUt1j25.json
Preview (first 2KB): ..."

Key fixes for local MCP

  1. Chunk the PDF before sending
    Instead of sending the whole PDF as a single large string, break it into smaller chunks (e.g., 5–10 pages per chunk) and send them sequentially. This keeps each request under the context window and allows Claude to process them in parts.

Example (Python):

import PyPDF2
from io import BytesIO

def chunk_pdf(pdf_path, chunk_size=10):
    with open(pdf_path, 'rb') as f:
        reader = PyPDF2.PdfReader(f)
        for i in range(0, len(reader.pages), chunk_size):
            chunk_pages = reader.pages[i:i+chunk_size]
            text = "\n".join([p.extract_text() for p in chunk_pages])
            yield text
  1. Use a streaming or incremental approach
    If your MCP server supports it, send the PDF in streaming chunks so Claude can process and respond to each chunk as it arrives, rather than waiting for the whole file.
Reading large PDFs from Obsidian results in the following error in Claude: "Output too large (26.3MB). Full output saved to: /sessions/blissful-loving-ramanujan/mnt/.claude/projects/-sessions-blissful-loving-ramanujan/b4356531-59f8-4e81-b961-78bd891c750e/tool-results/toolu_018NNa4YyBeRLXSSEgUt1j25.json Preview (first 2KB): ..." Key fixes for local MCP 1. Chunk the PDF before sending Instead of sending the whole PDF as a single large string, break it into smaller chunks (e.g., 5–10 pages per chunk) and send them sequentially. This keeps each request under the context window and allows Claude to process them in parts. Example (Python): ```python import PyPDF2 from io import BytesIO def chunk_pdf(pdf_path, chunk_size=10): with open(pdf_path, 'rb') as f: reader = PyPDF2.PdfReader(f) for i in range(0, len(reader.pages), chunk_size): chunk_pages = reader.pages[i:i+chunk_size] text = "\n".join([p.extract_text() for p in chunk_pages]) yield text ``` 2. Use a streaming or incremental approach If your MCP server supports it, send the PDF in streaming chunks so Claude can process and respond to each chunk as it arrives, rather than waiting for the whole file.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: verint.com/obsidian-mcp#5