Skip to content

Commit 7835283

Browse files
committed
cap length of context update in pdf-server
1 parent 70d360e commit 7835283

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

examples/pdf-server/src/mcp-app.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import { TextLayer } from "pdfjs-dist";
1313
import "./global.css";
1414
import "./mcp-app.css";
1515

16+
// const MAX_MODEL_CONTEXT_LENGTH = 5000;
17+
const MAX_MODEL_CONTEXT_LENGTH = 1500;
18+
1619
// Configure PDF.js worker
1720
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL(
1821
"pdfjs-dist/build/pdf.worker.mjs",
@@ -273,7 +276,7 @@ async function updatePageContext() {
273276
}
274277

275278
// Format content with selection and truncation
276-
const content = formatPageContent(pageText, 5000, selection);
279+
const content = formatPageContent(pageText, MAX_MODEL_CONTEXT_LENGTH, selection);
277280

278281
const markdown = `---
279282
title: ${pdfTitle || ""}

0 commit comments

Comments
 (0)