Skip to content

Commit d8153ba

Browse files
Martinclaude
andcommitted
refactor: complete v3 cleanup and critical bug fixes
Phase 1: Remove legacy v2 handlers and schemas - Delete 6 legacy handlers (getMetadata, getPageStats, getToc, listImages, renderPage, readPdf) - Delete 6 legacy schemas - Remove pdfCacheStats from cache handler Phase 2: Streamline to 6 core tools - Register only: pdf_info, pdf_read, pdf_extract_image, pdf_ocr, pdf_search, _pdf_cache_clear - Update server instructions and tool comments Phase 3: Critical stability fixes - Remove debug file I/O from render.ts (prevents disk filling) - Add ReDoS protection to searchPdf.ts (100 char regex limit) - Verify pdfDocument.destroy() cleanup in all handlers - Remove useless try-catch in render.ts Phase 4: Performance optimizations - Replace inefficient regex character counting in pdfOcr.ts with loop - Fix non-null assertion in character counting - Verify tool naming consistency Tests: Update integration tests and remove obsolete test files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent f5fb70d commit d8153ba

26 files changed

+1742
-5028
lines changed

dist/index.js

Lines changed: 1647 additions & 2288 deletions
Large diffs are not rendered by default.

src/handlers/cache.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
import { text, tool, toolError } from '@sylphx/mcp-server-sdk';
2-
import { cacheClearArgsSchema, cacheStatsArgsSchema } from '../schemas/cache.js';
3-
import { clearCache, getCacheStats } from '../utils/cache.js';
4-
5-
export const pdfCacheStats = tool()
6-
.description('Inspect cache usage for text and OCR results.')
7-
.input(cacheStatsArgsSchema)
8-
.handler(async () => {
9-
const stats = getCacheStats();
10-
return [text(JSON.stringify({ stats }, null, 2))];
11-
});
2+
import { cacheClearArgsSchema } from '../schemas/cache.js';
3+
import { clearCache } from '../utils/cache.js';
124

135
export const pdfCacheClear = tool()
146
.description('Clear text and/or OCR caches.')

src/handlers/getMetadata.ts

Lines changed: 0 additions & 166 deletions
This file was deleted.

src/handlers/getPageStats.ts

Lines changed: 0 additions & 141 deletions
This file was deleted.

0 commit comments

Comments
 (0)