@shuji-bonji/pdf-reader-mcp 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/LICENSE +21 -0
  3. package/README.ja.md +190 -0
  4. package/README.md +206 -0
  5. package/dist/constants.d.ts +22 -0
  6. package/dist/constants.d.ts.map +1 -0
  7. package/dist/constants.js +23 -0
  8. package/dist/constants.js.map +1 -0
  9. package/dist/index.d.ts +9 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +35 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/schemas/common.d.ts +14 -0
  14. package/dist/schemas/common.d.ts.map +1 -0
  15. package/dist/schemas/common.js +26 -0
  16. package/dist/schemas/common.js.map +1 -0
  17. package/dist/schemas/tier1.d.ts +104 -0
  18. package/dist/schemas/tier1.d.ts.map +1 -0
  19. package/dist/schemas/tier1.js +77 -0
  20. package/dist/schemas/tier1.js.map +1 -0
  21. package/dist/schemas/tier2.d.ts +68 -0
  22. package/dist/schemas/tier2.d.ts.map +1 -0
  23. package/dist/schemas/tier2.js +42 -0
  24. package/dist/schemas/tier2.js.map +1 -0
  25. package/dist/schemas/tier3.d.ts +44 -0
  26. package/dist/schemas/tier3.d.ts.map +1 -0
  27. package/dist/schemas/tier3.js +28 -0
  28. package/dist/schemas/tier3.js.map +1 -0
  29. package/dist/services/pdfjs-service.d.ts +65 -0
  30. package/dist/services/pdfjs-service.d.ts.map +1 -0
  31. package/dist/services/pdfjs-service.js +520 -0
  32. package/dist/services/pdfjs-service.js.map +1 -0
  33. package/dist/services/pdflib-service.d.ts +35 -0
  34. package/dist/services/pdflib-service.d.ts.map +1 -0
  35. package/dist/services/pdflib-service.js +318 -0
  36. package/dist/services/pdflib-service.js.map +1 -0
  37. package/dist/services/url-fetcher.d.ts +8 -0
  38. package/dist/services/url-fetcher.d.ts.map +1 -0
  39. package/dist/services/url-fetcher.js +40 -0
  40. package/dist/services/url-fetcher.js.map +1 -0
  41. package/dist/services/validation-service.d.ts +49 -0
  42. package/dist/services/validation-service.d.ts.map +1 -0
  43. package/dist/services/validation-service.js +670 -0
  44. package/dist/services/validation-service.js.map +1 -0
  45. package/dist/tools/index.d.ts +10 -0
  46. package/dist/tools/index.d.ts.map +1 -0
  47. package/dist/tools/index.js +46 -0
  48. package/dist/tools/index.js.map +1 -0
  49. package/dist/tools/tier1/get-metadata.d.ts +6 -0
  50. package/dist/tools/tier1/get-metadata.d.ts.map +1 -0
  51. package/dist/tools/tier1/get-metadata.js +49 -0
  52. package/dist/tools/tier1/get-metadata.js.map +1 -0
  53. package/dist/tools/tier1/get-page-count.d.ts +6 -0
  54. package/dist/tools/tier1/get-page-count.d.ts.map +1 -0
  55. package/dist/tools/tier1/get-page-count.js +50 -0
  56. package/dist/tools/tier1/get-page-count.js.map +1 -0
  57. package/dist/tools/tier1/read-images.d.ts +6 -0
  58. package/dist/tools/tier1/read-images.d.ts.map +1 -0
  59. package/dist/tools/tier1/read-images.js +79 -0
  60. package/dist/tools/tier1/read-images.js.map +1 -0
  61. package/dist/tools/tier1/read-text.d.ts +6 -0
  62. package/dist/tools/tier1/read-text.d.ts.map +1 -0
  63. package/dist/tools/tier1/read-text.js +57 -0
  64. package/dist/tools/tier1/read-text.js.map +1 -0
  65. package/dist/tools/tier1/read-url.d.ts +6 -0
  66. package/dist/tools/tier1/read-url.d.ts.map +1 -0
  67. package/dist/tools/tier1/read-url.js +64 -0
  68. package/dist/tools/tier1/read-url.js.map +1 -0
  69. package/dist/tools/tier1/search-text.d.ts +6 -0
  70. package/dist/tools/tier1/search-text.d.ts.map +1 -0
  71. package/dist/tools/tier1/search-text.js +62 -0
  72. package/dist/tools/tier1/search-text.js.map +1 -0
  73. package/dist/tools/tier1/summarize.d.ts +6 -0
  74. package/dist/tools/tier1/summarize.d.ts.map +1 -0
  75. package/dist/tools/tier1/summarize.js +70 -0
  76. package/dist/tools/tier1/summarize.js.map +1 -0
  77. package/dist/tools/tier2/inspect-annotations.d.ts +6 -0
  78. package/dist/tools/tier2/inspect-annotations.d.ts.map +1 -0
  79. package/dist/tools/tier2/inspect-annotations.js +47 -0
  80. package/dist/tools/tier2/inspect-annotations.js.map +1 -0
  81. package/dist/tools/tier2/inspect-fonts.d.ts +6 -0
  82. package/dist/tools/tier2/inspect-fonts.d.ts.map +1 -0
  83. package/dist/tools/tier2/inspect-fonts.js +54 -0
  84. package/dist/tools/tier2/inspect-fonts.js.map +1 -0
  85. package/dist/tools/tier2/inspect-signatures.d.ts +6 -0
  86. package/dist/tools/tier2/inspect-signatures.d.ts.map +1 -0
  87. package/dist/tools/tier2/inspect-signatures.js +48 -0
  88. package/dist/tools/tier2/inspect-signatures.js.map +1 -0
  89. package/dist/tools/tier2/inspect-structure.d.ts +6 -0
  90. package/dist/tools/tier2/inspect-structure.d.ts.map +1 -0
  91. package/dist/tools/tier2/inspect-structure.js +46 -0
  92. package/dist/tools/tier2/inspect-structure.js.map +1 -0
  93. package/dist/tools/tier2/inspect-tags.d.ts +6 -0
  94. package/dist/tools/tier2/inspect-tags.d.ts.map +1 -0
  95. package/dist/tools/tier2/inspect-tags.js +46 -0
  96. package/dist/tools/tier2/inspect-tags.js.map +1 -0
  97. package/dist/tools/tier3/compare-structure.d.ts +6 -0
  98. package/dist/tools/tier3/compare-structure.d.ts.map +1 -0
  99. package/dist/tools/tier3/compare-structure.js +47 -0
  100. package/dist/tools/tier3/compare-structure.js.map +1 -0
  101. package/dist/tools/tier3/validate-metadata.d.ts +6 -0
  102. package/dist/tools/tier3/validate-metadata.d.ts.map +1 -0
  103. package/dist/tools/tier3/validate-metadata.js +57 -0
  104. package/dist/tools/tier3/validate-metadata.js.map +1 -0
  105. package/dist/tools/tier3/validate-tagged.d.ts +6 -0
  106. package/dist/tools/tier3/validate-tagged.d.ts.map +1 -0
  107. package/dist/tools/tier3/validate-tagged.js +56 -0
  108. package/dist/tools/tier3/validate-tagged.js.map +1 -0
  109. package/dist/types.d.ts +226 -0
  110. package/dist/types.d.ts.map +1 -0
  111. package/dist/types.js +5 -0
  112. package/dist/types.js.map +1 -0
  113. package/dist/utils/batch-processor.d.ts +60 -0
  114. package/dist/utils/batch-processor.d.ts.map +1 -0
  115. package/dist/utils/batch-processor.js +72 -0
  116. package/dist/utils/batch-processor.js.map +1 -0
  117. package/dist/utils/error-handler.d.ts +23 -0
  118. package/dist/utils/error-handler.d.ts.map +1 -0
  119. package/dist/utils/error-handler.js +76 -0
  120. package/dist/utils/error-handler.js.map +1 -0
  121. package/dist/utils/formatter.d.ts +64 -0
  122. package/dist/utils/formatter.d.ts.map +1 -0
  123. package/dist/utils/formatter.js +379 -0
  124. package/dist/utils/formatter.js.map +1 -0
  125. package/dist/utils/pdf-helpers.d.ts +22 -0
  126. package/dist/utils/pdf-helpers.d.ts.map +1 -0
  127. package/dist/utils/pdf-helpers.js +68 -0
  128. package/dist/utils/pdf-helpers.js.map +1 -0
  129. package/package.json +78 -0
@@ -0,0 +1,70 @@
1
+ /**
2
+ * summarize - Quick overview report of a PDF document.
3
+ */
4
+ import { ResponseFormat } from '../../constants.js';
5
+ import { SummarizeSchema } from '../../schemas/tier1.js';
6
+ import { countImagesFromDoc, extractTextFromDoc, getMetadataFromDoc, loadDocument, } from '../../services/pdfjs-service.js';
7
+ import { handleError } from '../../utils/error-handler.js';
8
+ import { formatSummaryMarkdown } from '../../utils/formatter.js';
9
+ export function registerSummarize(server) {
10
+ server.registerTool('summarize', {
11
+ title: 'Summarize PDF',
12
+ description: `Generate a quick overview report of a PDF document.
13
+
14
+ Combines metadata, text presence check, image count, and a text preview from the first page into a single summary. Useful as a first step before deciding which detailed tools to use.
15
+
16
+ Args:
17
+ - file_path (string): Absolute path to a local PDF file
18
+ - response_format ('markdown' | 'json'): Output format (default: 'markdown')
19
+
20
+ Returns:
21
+ Summary including: page count, PDF version, file size, tagged/encrypted/signature flags, text presence, image count, and a text preview from page 1.
22
+
23
+ Examples:
24
+ - Quick overview: { file_path: "/path/to/doc.pdf" }
25
+ - Machine-readable: { file_path: "/path/to/doc.pdf", response_format: "json" }`,
26
+ inputSchema: SummarizeSchema,
27
+ annotations: {
28
+ readOnlyHint: true,
29
+ destructiveHint: false,
30
+ idempotentHint: true,
31
+ openWorldHint: false,
32
+ },
33
+ }, async (params) => {
34
+ try {
35
+ // Load the PDF document once and reuse for all operations
36
+ const doc = await loadDocument(params.file_path);
37
+ try {
38
+ const [metadata, firstPageTexts, imageCount] = await Promise.all([
39
+ getMetadataFromDoc(doc, params.file_path),
40
+ extractTextFromDoc(doc, '1'),
41
+ countImagesFromDoc(doc),
42
+ ]);
43
+ const textPreview = firstPageTexts[0]?.text?.slice(0, 500) ?? '';
44
+ const hasText = textPreview.trim().length > 0;
45
+ const summary = {
46
+ filePath: params.file_path,
47
+ metadata,
48
+ textPreview,
49
+ imageCount,
50
+ hasText,
51
+ };
52
+ const text = params.response_format === ResponseFormat.JSON
53
+ ? JSON.stringify(summary, null, 2)
54
+ : formatSummaryMarkdown(summary);
55
+ return {
56
+ content: [{ type: 'text', text }],
57
+ };
58
+ }
59
+ finally {
60
+ await doc.destroy();
61
+ }
62
+ }
63
+ catch (error) {
64
+ return {
65
+ content: [{ type: 'text', text: handleError(error) }],
66
+ };
67
+ }
68
+ });
69
+ }
70
+ //# sourceMappingURL=summarize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summarize.js","sourceRoot":"","sources":["../../../src/tools/tier1/summarize.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAuB,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,GACb,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,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,OAAO,CAAC,CAAC;gBAErC,OAAO;oBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC;iBAC3C,CAAC;YACJ,CAAC;oBAAS,CAAC;gBACT,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;YACtB,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;aAC/D,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * inspect_annotations - PDF annotation analysis.
3
+ */
4
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ export declare function registerInspectAnnotations(server: McpServer): void;
6
+ //# sourceMappingURL=inspect-annotations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect-annotations.d.ts","sourceRoot":"","sources":["../../../src/tools/tier2/inspect-annotations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA2ClE"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * inspect_annotations - PDF annotation analysis.
3
+ */
4
+ import { ResponseFormat } from '../../constants.js';
5
+ import { InspectAnnotationsSchema } from '../../schemas/tier2.js';
6
+ import { analyzeAnnotations } from '../../services/pdfjs-service.js';
7
+ import { handleError } from '../../utils/error-handler.js';
8
+ import { formatAnnotationsMarkdown, truncateIfNeeded } from '../../utils/formatter.js';
9
+ export function registerInspectAnnotations(server) {
10
+ server.registerTool('inspect_annotations', {
11
+ title: 'Inspect PDF Annotations',
12
+ description: `Extract and categorize all annotations in a PDF document.
13
+
14
+ Args:
15
+ - file_path (string): Absolute path to a local PDF file
16
+ - pages (string, optional): Page range. Format: "1-5", "3", or "1,3,5-7". Omit for all pages.
17
+ - response_format ('markdown' | 'json'): Output format (default: 'markdown')
18
+
19
+ Returns:
20
+ Total annotation count, breakdown by subtype (Link, Widget, Highlight, Text, etc.) and by page, flags for links/forms/markup presence, and individual annotation details.
21
+
22
+ Examples:
23
+ - Check for form fields (Widget annotations)
24
+ - Find all links in a document
25
+ - Inventory markup annotations (highlights, comments)`,
26
+ inputSchema: InspectAnnotationsSchema,
27
+ annotations: {
28
+ readOnlyHint: true,
29
+ destructiveHint: false,
30
+ idempotentHint: true,
31
+ openWorldHint: false,
32
+ },
33
+ }, async (params) => {
34
+ try {
35
+ const analysis = await analyzeAnnotations(params.file_path, params.pages);
36
+ const raw = params.response_format === ResponseFormat.JSON
37
+ ? JSON.stringify(analysis, null, 2)
38
+ : formatAnnotationsMarkdown(analysis);
39
+ const { text } = truncateIfNeeded(raw);
40
+ return { content: [{ type: 'text', text }] };
41
+ }
42
+ catch (error) {
43
+ return { content: [{ type: 'text', text: handleError(error) }] };
44
+ }
45
+ });
46
+ }
47
+ //# sourceMappingURL=inspect-annotations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect-annotations.js","sourceRoot":"","sources":["../../../src/tools/tier2/inspect-annotations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAgC,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEvF,MAAM,UAAU,0BAA0B,CAAC,MAAiB;IAC1D,MAAM,CAAC,YAAY,CACjB,qBAAqB,EACrB;QACE,KAAK,EAAE,yBAAyB;QAChC,WAAW,EAAE;;;;;;;;;;;;;wDAaqC;QAClD,WAAW,EAAE,wBAAwB;QACrC,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF,EACD,KAAK,EAAE,MAA+B,EAAE,EAAE;QACxC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,kBAAkB,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;YAE1E,MAAM,GAAG,GACP,MAAM,CAAC,eAAe,KAAK,cAAc,CAAC,IAAI;gBAC5C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;gBACnC,CAAC,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAC;YAE1C,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;YACvC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACxD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5E,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * inspect_fonts - PDF font analysis.
3
+ */
4
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ export declare function registerInspectFonts(server: McpServer): void;
6
+ //# sourceMappingURL=inspect-fonts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect-fonts.d.ts","sourceRoot":"","sources":["../../../src/tools/tier2/inspect-fonts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAQzE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAmD5D"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * inspect_fonts - PDF font analysis.
3
+ */
4
+ import { ResponseFormat } from '../../constants.js';
5
+ import { InspectFontsSchema } from '../../schemas/tier2.js';
6
+ import { analyzeFontsWithPdfLib } from '../../services/pdflib-service.js';
7
+ import { handleError } from '../../utils/error-handler.js';
8
+ import { formatFontsMarkdown, truncateIfNeeded } from '../../utils/formatter.js';
9
+ export function registerInspectFonts(server) {
10
+ server.registerTool('inspect_fonts', {
11
+ title: 'Inspect PDF Fonts',
12
+ description: `List all fonts used in a PDF document with their properties.
13
+
14
+ Args:
15
+ - file_path (string): Absolute path to a local PDF file
16
+ - response_format ('markdown' | 'json'): Output format (default: 'markdown')
17
+
18
+ Returns:
19
+ Font name, type (TrueType, Type1, CIDFont, etc.), encoding, embedded/subset status, and pages where each font is used.
20
+
21
+ Examples:
22
+ - Check if all fonts are embedded (required for PDF/A, PDF/X)
23
+ - Identify font types and encodings
24
+ - Find which pages use specific fonts`,
25
+ inputSchema: InspectFontsSchema,
26
+ annotations: {
27
+ readOnlyHint: true,
28
+ destructiveHint: false,
29
+ idempotentHint: true,
30
+ openWorldHint: false,
31
+ },
32
+ }, async (params) => {
33
+ try {
34
+ const result = await analyzeFontsWithPdfLib(params.file_path);
35
+ const fonts = Array.from(result.fontMap.values());
36
+ const analysis = {
37
+ fonts,
38
+ totalFontCount: fonts.length,
39
+ embeddedCount: fonts.filter((f) => f.isEmbedded).length,
40
+ subsetCount: fonts.filter((f) => f.isSubset).length,
41
+ pagesScanned: result.pagesScanned,
42
+ };
43
+ const raw = params.response_format === ResponseFormat.JSON
44
+ ? JSON.stringify(analysis, null, 2)
45
+ : formatFontsMarkdown(analysis);
46
+ const { text } = truncateIfNeeded(raw);
47
+ return { content: [{ type: 'text', text }] };
48
+ }
49
+ catch (error) {
50
+ return { content: [{ type: 'text', text: handleError(error) }] };
51
+ }
52
+ });
53
+ }
54
+ //# sourceMappingURL=inspect-fonts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect-fonts.js","sourceRoot":"","sources":["../../../src/tools/tier2/inspect-fonts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAA0B,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjF,MAAM,UAAU,oBAAoB,CAAC,MAAiB;IACpD,MAAM,CAAC,YAAY,CACjB,eAAe,EACf;QACE,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EAAE;;;;;;;;;;;;wCAYqB;QAClC,WAAW,EAAE,kBAAkB;QAC/B,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF,EACD,KAAK,EAAE,MAAyB,EAAE,EAAE;QAClC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,sBAAsB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAC9D,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;YAElD,MAAM,QAAQ,GAAkB;gBAC9B,KAAK;gBACL,cAAc,EAAE,KAAK,CAAC,MAAM;gBAC5B,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM;gBACvD,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM;gBACnD,YAAY,EAAE,MAAM,CAAC,YAAY;aAClC,CAAC;YAEF,MAAM,GAAG,GACP,MAAM,CAAC,eAAe,KAAK,cAAc,CAAC,IAAI;gBAC5C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;gBACnC,CAAC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;YAEpC,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;YACvC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACxD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5E,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * inspect_signatures - PDF digital signature analysis.
3
+ */
4
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ export declare function registerInspectSignatures(server: McpServer): void;
6
+ //# sourceMappingURL=inspect-signatures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect-signatures.d.ts","sourceRoot":"","sources":["../../../src/tools/tier2/inspect-signatures.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA4CjE"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * inspect_signatures - PDF digital signature analysis.
3
+ */
4
+ import { ResponseFormat } from '../../constants.js';
5
+ import { InspectSignaturesSchema } from '../../schemas/tier2.js';
6
+ import { analyzeSignatures } from '../../services/pdflib-service.js';
7
+ import { handleError } from '../../utils/error-handler.js';
8
+ import { formatSignaturesMarkdown, truncateIfNeeded } from '../../utils/formatter.js';
9
+ export function registerInspectSignatures(server) {
10
+ server.registerTool('inspect_signatures', {
11
+ title: 'Inspect PDF Digital Signatures',
12
+ description: `Examine digital signature fields in a PDF document.
13
+
14
+ Args:
15
+ - file_path (string): Absolute path to a local PDF file
16
+ - response_format ('markdown' | 'json'): Output format (default: 'markdown')
17
+
18
+ Returns:
19
+ Total signature field count, signed/unsigned breakdown, and details for each field (signer name, reason, location, signing time, filter/subFilter).
20
+
21
+ Note: This tool inspects signature field structure only. Cryptographic signature verification is not performed.
22
+
23
+ Examples:
24
+ - Check if a PDF has been digitally signed
25
+ - Inspect signer information and signing dates
26
+ - Verify signature field structure`,
27
+ inputSchema: InspectSignaturesSchema,
28
+ annotations: {
29
+ readOnlyHint: true,
30
+ destructiveHint: false,
31
+ idempotentHint: true,
32
+ openWorldHint: false,
33
+ },
34
+ }, async (params) => {
35
+ try {
36
+ const analysis = await analyzeSignatures(params.file_path);
37
+ const raw = params.response_format === ResponseFormat.JSON
38
+ ? JSON.stringify(analysis, null, 2)
39
+ : formatSignaturesMarkdown(analysis);
40
+ const { text } = truncateIfNeeded(raw);
41
+ return { content: [{ type: 'text', text }] };
42
+ }
43
+ catch (error) {
44
+ return { content: [{ type: 'text', text: handleError(error) }] };
45
+ }
46
+ });
47
+ }
48
+ //# sourceMappingURL=inspect-signatures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect-signatures.js","sourceRoot":"","sources":["../../../src/tools/tier2/inspect-signatures.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAA+B,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,iBAAiB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type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ export declare function registerInspectStructure(server: McpServer): void;
6
+ //# sourceMappingURL=inspect-structure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect-structure.d.ts","sourceRoot":"","sources":["../../../src/tools/tier2/inspect-structure.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA0ChE"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * inspect_structure - PDF internal structure analysis.
3
+ */
4
+ import { ResponseFormat } from '../../constants.js';
5
+ import { InspectStructureSchema } from '../../schemas/tier2.js';
6
+ import { analyzeStructure } from '../../services/pdflib-service.js';
7
+ import { handleError } from '../../utils/error-handler.js';
8
+ import { formatStructureMarkdown, truncateIfNeeded } from '../../utils/formatter.js';
9
+ export function registerInspectStructure(server) {
10
+ server.registerTool('inspect_structure', {
11
+ title: 'Inspect PDF Structure',
12
+ description: `Examine PDF internal object structure including catalog entries, page tree, and object statistics.
13
+
14
+ Args:
15
+ - file_path (string): Absolute path to a local PDF file
16
+ - response_format ('markdown' | 'json'): Output format (default: 'markdown')
17
+
18
+ Returns:
19
+ Catalog entries (keys and types), page tree info (page count, MediaBox samples), object statistics (total count, stream count, type distribution), and encryption status.
20
+
21
+ Examples:
22
+ - Examine document catalog for structural features
23
+ - Count PDF objects and streams
24
+ - Check page dimensions across the document`,
25
+ inputSchema: InspectStructureSchema,
26
+ annotations: {
27
+ readOnlyHint: true,
28
+ destructiveHint: false,
29
+ idempotentHint: true,
30
+ openWorldHint: false,
31
+ },
32
+ }, async (params) => {
33
+ try {
34
+ const analysis = await analyzeStructure(params.file_path);
35
+ const raw = params.response_format === ResponseFormat.JSON
36
+ ? JSON.stringify(analysis, null, 2)
37
+ : formatStructureMarkdown(analysis);
38
+ const { text } = truncateIfNeeded(raw);
39
+ return { content: [{ type: 'text', text }] };
40
+ }
41
+ catch (error) {
42
+ return { content: [{ type: 'text', text: handleError(error) }] };
43
+ }
44
+ });
45
+ }
46
+ //# sourceMappingURL=inspect-structure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect-structure.js","sourceRoot":"","sources":["../../../src/tools/tier2/inspect-structure.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAA8B,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAErF,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,MAAM,CAAC,YAAY,CACjB,mBAAmB,EACnB;QACE,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EAAE;;;;;;;;;;;;8CAY2B;QACxC,WAAW,EAAE,sBAAsB;QACnC,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF,EACD,KAAK,EAAE,MAA6B,EAAE,EAAE;QACtC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAE1D,MAAM,GAAG,GACP,MAAM,CAAC,eAAe,KAAK,cAAc,CAAC,IAAI;gBAC5C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;gBACnC,CAAC,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;YAExC,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;YACvC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACxD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5E,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * inspect_tags - Tagged PDF structure tree analysis.
3
+ */
4
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ export declare function registerInspectTags(server: McpServer): void;
6
+ //# sourceMappingURL=inspect-tags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect-tags.d.ts","sourceRoot":"","sources":["../../../src/tools/tier2/inspect-tags.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA0C3D"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * inspect_tags - Tagged PDF structure tree analysis.
3
+ */
4
+ import { ResponseFormat } from '../../constants.js';
5
+ import { InspectTagsSchema } from '../../schemas/tier2.js';
6
+ import { analyzeTags } from '../../services/pdfjs-service.js';
7
+ import { handleError } from '../../utils/error-handler.js';
8
+ import { formatTagsMarkdown, truncateIfNeeded } from '../../utils/formatter.js';
9
+ export function registerInspectTags(server) {
10
+ server.registerTool('inspect_tags', {
11
+ title: 'Inspect Tagged PDF Structure',
12
+ description: `Analyze the Tagged PDF structure tree for accessibility assessment.
13
+
14
+ Args:
15
+ - file_path (string): Absolute path to a local PDF file
16
+ - response_format ('markdown' | 'json'): Output format (default: 'markdown')
17
+
18
+ Returns:
19
+ Whether the PDF is tagged, the structure tree hierarchy with roles, max nesting depth, total element count, and role distribution (e.g., Document, P, H1, Table, Figure).
20
+
21
+ Examples:
22
+ - Check if a PDF is tagged for accessibility (PDF/UA)
23
+ - Inspect the tag hierarchy and role distribution
24
+ - Assess document structure quality`,
25
+ inputSchema: InspectTagsSchema,
26
+ annotations: {
27
+ readOnlyHint: true,
28
+ destructiveHint: false,
29
+ idempotentHint: true,
30
+ openWorldHint: false,
31
+ },
32
+ }, async (params) => {
33
+ try {
34
+ const analysis = await analyzeTags(params.file_path);
35
+ const raw = params.response_format === ResponseFormat.JSON
36
+ ? JSON.stringify(analysis, null, 2)
37
+ : formatTagsMarkdown(analysis);
38
+ const { text } = truncateIfNeeded(raw);
39
+ return { content: [{ type: 'text', text }] };
40
+ }
41
+ catch (error) {
42
+ return { content: [{ type: 'text', text: handleError(error) }] };
43
+ }
44
+ });
45
+ }
46
+ //# sourceMappingURL=inspect-tags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect-tags.js","sourceRoot":"","sources":["../../../src/tools/tier2/inspect-tags.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAyB,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEhF,MAAM,UAAU,mBAAmB,CAAC,MAAiB;IACnD,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,KAAK,EAAE,8BAA8B;QACrC,WAAW,EAAE;;;;;;;;;;;;sCAYmB;QAChC,WAAW,EAAE,iBAAiB;QAC9B,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF,EACD,KAAK,EAAE,MAAwB,EAAE,EAAE;QACjC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAErD,MAAM,GAAG,GACP,MAAM,CAAC,eAAe,KAAK,cAAc,CAAC,IAAI;gBAC5C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;gBACnC,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;YAEnC,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;YACvC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACxD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5E,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * compare_structure - Compare structures of two PDF documents.
3
+ */
4
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ export declare function registerCompareStructure(server: McpServer): void;
6
+ //# sourceMappingURL=compare-structure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare-structure.d.ts","sourceRoot":"","sources":["../../../src/tools/tier3/compare-structure.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA2ChE"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * compare_structure - Compare structures of two PDF documents.
3
+ */
4
+ import { ResponseFormat } from '../../constants.js';
5
+ import { CompareStructureSchema } from '../../schemas/tier3.js';
6
+ import { compareStructure } from '../../services/validation-service.js';
7
+ import { handleError } from '../../utils/error-handler.js';
8
+ import { formatCompareStructureMarkdown, truncateIfNeeded } from '../../utils/formatter.js';
9
+ export function registerCompareStructure(server) {
10
+ server.registerTool('compare_structure', {
11
+ title: 'Compare PDF Structures',
12
+ description: `Compare the internal structures of two PDF documents and identify differences.
13
+
14
+ Args:
15
+ - file_path_1 (string): Absolute path to the first PDF file
16
+ - file_path_2 (string): Absolute path to the second PDF file
17
+ - response_format ('markdown' | 'json'): Output format (default: 'markdown')
18
+
19
+ Returns:
20
+ Structural comparison including: property-by-property diff (page count, PDF version, encryption, tagged status, object counts, page dimensions, file size, catalog entries, signatures), font comparison (fonts unique to each file and shared fonts), and a summary.
21
+
22
+ Examples:
23
+ - Compare two versions of the same document
24
+ - Verify structural consistency across PDF exports
25
+ - Identify differences in PDF generation pipelines`,
26
+ inputSchema: CompareStructureSchema,
27
+ annotations: {
28
+ readOnlyHint: true,
29
+ destructiveHint: false,
30
+ idempotentHint: true,
31
+ openWorldHint: false,
32
+ },
33
+ }, async (params) => {
34
+ try {
35
+ const result = await compareStructure(params.file_path_1, params.file_path_2);
36
+ const raw = params.response_format === ResponseFormat.JSON
37
+ ? JSON.stringify(result, null, 2)
38
+ : formatCompareStructureMarkdown(result);
39
+ const { text } = truncateIfNeeded(raw);
40
+ return { content: [{ type: 'text', text }] };
41
+ }
42
+ catch (error) {
43
+ return { content: [{ type: 'text', text: handleError(error) }] };
44
+ }
45
+ });
46
+ }
47
+ //# sourceMappingURL=compare-structure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare-structure.js","sourceRoot":"","sources":["../../../src/tools/tier3/compare-structure.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAA8B,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC5F,O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 * validate_metadata - PDF metadata conformance validation.
3
+ */
4
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ export declare function registerValidateMetadata(server: McpServer): void;
6
+ //# sourceMappingURL=validate-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-metadata.d.ts","sourceRoot":"","sources":["../../../src/tools/tier3/validate-metadata.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAqDhE"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * validate_metadata - PDF metadata conformance validation.
3
+ */
4
+ import { ResponseFormat } from '../../constants.js';
5
+ import { ValidateMetadataSchema } from '../../schemas/tier3.js';
6
+ import { validateMetadata } from '../../services/validation-service.js';
7
+ import { handleError } from '../../utils/error-handler.js';
8
+ import { formatMetadataValidationMarkdown, truncateIfNeeded } from '../../utils/formatter.js';
9
+ export function registerValidateMetadata(server) {
10
+ server.registerTool('validate_metadata', {
11
+ title: 'Validate PDF Metadata',
12
+ description: `Validate PDF metadata conformance against best practices and specification requirements.
13
+
14
+ Args:
15
+ - file_path (string): Absolute path to a local PDF file
16
+ - response_format ('markdown' | 'json'): Output format (default: 'markdown')
17
+
18
+ Returns:
19
+ Validation results including: total checks, pass/fail counts, detailed issues with severity, metadata field presence summary, and an overall summary.
20
+
21
+ Checks performed:
22
+ - Title presence (required for PDF/UA, PDF/A)
23
+ - Author presence
24
+ - Creation date format validation
25
+ - Modification date presence
26
+ - Producer identification
27
+ - PDF version detection
28
+ - Tagged flag status
29
+ - Subject and Keywords presence
30
+ - Encryption and accessibility impact
31
+
32
+ Examples:
33
+ - Verify PDF metadata completeness for PDF/A archival
34
+ - Check metadata requirements for PDF/UA compliance
35
+ - Audit document metadata for publishing standards`,
36
+ inputSchema: ValidateMetadataSchema,
37
+ annotations: {
38
+ readOnlyHint: true,
39
+ destructiveHint: false,
40
+ idempotentHint: true,
41
+ openWorldHint: false,
42
+ },
43
+ }, async (params) => {
44
+ try {
45
+ const result = await validateMetadata(params.file_path);
46
+ const raw = params.response_format === ResponseFormat.JSON
47
+ ? JSON.stringify(result, null, 2)
48
+ : formatMetadataValidationMarkdown(result);
49
+ const { text } = truncateIfNeeded(raw);
50
+ return { content: [{ type: 'text', text }] };
51
+ }
52
+ catch (error) {
53
+ return { content: [{ type: 'text', text: handleError(error) }] };
54
+ }
55
+ });
56
+ }
57
+ //# sourceMappingURL=validate-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-metadata.js","sourceRoot":"","sources":["../../../src/tools/tier3/validate-metadata.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAA8B,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,gCAAgC,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE9F,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,MAAM,CAAC,YAAY,CACjB,mBAAmB,EACnB;QACE,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;qDAuBkC;QAC/C,WAAW,EAAE,sBAAsB;QACnC,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF,EACD,KAAK,EAAE,MAA6B,EAAE,EAAE;QACtC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAExD,MAAM,GAAG,GACP,MAAM,CAAC,eAAe,KAAK,cAAc,CAAC,IAAI;gBAC5C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjC,CAAC,CAAC,gCAAgC,CAAC,MAAM,CAAC,CAAC;YAE/C,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;YACvC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACxD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5E,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * validate_tagged - PDF/UA tagged structure validation.
3
+ */
4
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ export declare function registerValidateTagged(server: McpServer): void;
6
+ //# sourceMappingURL=validate-tagged.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-tagged.d.ts","sourceRoot":"","sources":["../../../src/tools/tier3/validate-tagged.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAoD9D"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * validate_tagged - PDF/UA tagged structure validation.
3
+ */
4
+ import { ResponseFormat } from '../../constants.js';
5
+ import { ValidateTaggedSchema } from '../../schemas/tier3.js';
6
+ import { validateTagged } from '../../services/validation-service.js';
7
+ import { handleError } from '../../utils/error-handler.js';
8
+ import { formatTaggedValidationMarkdown, truncateIfNeeded } from '../../utils/formatter.js';
9
+ export function registerValidateTagged(server) {
10
+ server.registerTool('validate_tagged', {
11
+ title: 'Validate Tagged PDF',
12
+ description: `Validate PDF/UA tagged structure requirements.
13
+
14
+ Args:
15
+ - file_path (string): Absolute path to a local PDF file
16
+ - response_format ('markdown' | 'json'): Output format (default: 'markdown')
17
+
18
+ Returns:
19
+ Validation results including: whether the PDF is tagged, total checks performed, pass/fail counts, detailed issues with severity levels (error/warning/info), and a summary.
20
+
21
+ Checks performed:
22
+ - Document marked as tagged
23
+ - Structure tree root existence
24
+ - Document root tag presence
25
+ - Heading hierarchy (H1-H6) sequential order
26
+ - Figure tags for images
27
+ - Paragraph tag presence
28
+ - Structure element count
29
+ - Table tag structure (TR/TH/TD)
30
+
31
+ Examples:
32
+ - Check if a PDF meets PDF/UA accessibility requirements
33
+ - Identify missing or incorrect tag structure
34
+ - Assess document accessibility quality`,
35
+ inputSchema: ValidateTaggedSchema,
36
+ annotations: {
37
+ readOnlyHint: true,
38
+ destructiveHint: false,
39
+ idempotentHint: true,
40
+ openWorldHint: false,
41
+ },
42
+ }, async (params) => {
43
+ try {
44
+ const result = await validateTagged(params.file_path);
45
+ const raw = params.response_format === ResponseFormat.JSON
46
+ ? JSON.stringify(result, null, 2)
47
+ : formatTaggedValidationMarkdown(result);
48
+ const { text } = truncateIfNeeded(raw);
49
+ return { content: [{ type: 'text', text }] };
50
+ }
51
+ catch (error) {
52
+ return { content: [{ type: 'text', text: handleError(error) }] };
53
+ }
54
+ });
55
+ }
56
+ //# sourceMappingURL=validate-tagged.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-tagged.js","sourceRoot":"","sources":["../../../src/tools/tier3/validate-tagged.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAA4B,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EA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