@shuji-bonji/pdf-reader-mcp 0.16.1 → 0.18.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.
- package/CHANGELOG.md +44 -1
- package/README.ja.md +12 -27
- package/README.md +11 -26
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/schemas/tier3.d.ts +0 -12
- package/dist/schemas/tier3.d.ts.map +1 -1
- package/dist/schemas/tier3.js +0 -14
- package/dist/schemas/tier3.js.map +1 -1
- package/dist/services/page-renderer.d.ts +19 -0
- package/dist/services/page-renderer.d.ts.map +1 -1
- package/dist/services/page-renderer.js +32 -15
- package/dist/services/page-renderer.js.map +1 -1
- package/dist/services/pdfjs-service.d.ts +1 -6
- package/dist/services/pdfjs-service.d.ts.map +1 -1
- package/dist/services/pdfjs-service.js +0 -98
- package/dist/services/pdfjs-service.js.map +1 -1
- package/dist/services/validation-service.d.ts +4 -45
- package/dist/services/validation-service.d.ts.map +1 -1
- package/dist/services/validation-service.js +4 -662
- package/dist/services/validation-service.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +0 -4
- package/dist/tools/index.js.map +1 -1
- package/dist/types.d.ts +0 -50
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/formatter.d.ts +1 -9
- package/dist/utils/formatter.d.ts.map +1 -1
- package/dist/utils/formatter.js +1 -78
- package/dist/utils/formatter.js.map +1 -1
- package/package.json +1 -1
- package/dist/tools/tier3/validate-metadata.d.ts +0 -6
- package/dist/tools/tier3/validate-metadata.d.ts.map +0 -1
- package/dist/tools/tier3/validate-metadata.js +0 -73
- package/dist/tools/tier3/validate-metadata.js.map +0 -1
- package/dist/tools/tier3/validate-tagged.d.ts +0 -6
- package/dist/tools/tier3/validate-tagged.d.ts.map +0 -1
- package/dist/tools/tier3/validate-tagged.js +0 -74
- package/dist/tools/tier3/validate-tagged.js.map +0 -1
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { ResponseFormat } from '../../constants.js';
|
|
2
|
-
import { ValidateTaggedSchema } from '../../schemas/tier3.js';
|
|
3
|
-
import { validateTagged } from '../../services/validation-service.js';
|
|
4
|
-
import { handleStructuredError } from '../../utils/error-handler.js';
|
|
5
|
-
import { formatTaggedValidationMarkdown, truncateIfNeeded } from '../../utils/formatter.js';
|
|
6
|
-
export function registerValidateTagged(server) {
|
|
7
|
-
server.registerTool('validate_tagged', {
|
|
8
|
-
title: 'Validate Tagged PDF (deprecated)',
|
|
9
|
-
description: `[DEPRECATED — will be removed in the next major version]
|
|
10
|
-
|
|
11
|
-
Prefer pdf-verify-mcp's \`validate_conformance\` with \`flavour: "pdfua-1"\` (or \`"pdfua-2"\`).
|
|
12
|
-
It supersedes this tool rather than merely replacing it: it verifies the actual \`/Alt\` and
|
|
13
|
-
\`/ActualText\` values of Figure tags (this tool only counts Figures), checks Link \`/Contents\`,
|
|
14
|
-
inspects StructTreeRoot from the catalog directly (this tool synthesises it per page), cites
|
|
15
|
-
ISO 14289 clauses, and delegates to veraPDF when available.
|
|
16
|
-
|
|
17
|
-
Reason: the family boundary is "pass/fail against an ISO standard belongs to pdf-verify-mcp;
|
|
18
|
-
reporting observations belongs to pdf-reader-mcp". This tool predates pdf-verify-mcp and was
|
|
19
|
-
the exception. Use \`inspect_tags\` here for structure-tree facts — that tool is NOT deprecated.
|
|
20
|
-
|
|
21
|
-
This tool remains a quick preflight and still works. Only the checks below are performed;
|
|
22
|
-
a pass here does not imply PDF/UA conformance.
|
|
23
|
-
|
|
24
|
-
Validate PDF/UA tagged structure requirements.
|
|
25
|
-
|
|
26
|
-
Args:
|
|
27
|
-
- file_path (string): Absolute path to a local PDF file
|
|
28
|
-
- response_format ('markdown' | 'json'): Output format (default: 'markdown')
|
|
29
|
-
|
|
30
|
-
Returns:
|
|
31
|
-
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.
|
|
32
|
-
|
|
33
|
-
\`totalChecks\` counts the checks that were actually decided. A check whose premise could not be observed is not counted there and appears in \`notChecked\` with the reason — TAG-005 judges Figure tags against the number of images the page draws, so without that number it would have to assume zero images and would report a pass for something nobody looked at.
|
|
34
|
-
|
|
35
|
-
Checks performed:
|
|
36
|
-
- Document marked as tagged
|
|
37
|
-
- Structure tree root existence
|
|
38
|
-
- Document root tag presence
|
|
39
|
-
- Heading hierarchy (H1-H6) sequential order
|
|
40
|
-
- Figure tags for images
|
|
41
|
-
- Paragraph tag presence
|
|
42
|
-
- Structure element count
|
|
43
|
-
- Table tag structure (TR/TH/TD)
|
|
44
|
-
|
|
45
|
-
Examples:
|
|
46
|
-
- Check if a PDF meets PDF/UA accessibility requirements
|
|
47
|
-
- Identify missing or incorrect tag structure
|
|
48
|
-
- Assess document accessibility quality`,
|
|
49
|
-
inputSchema: ValidateTaggedSchema,
|
|
50
|
-
annotations: {
|
|
51
|
-
readOnlyHint: true,
|
|
52
|
-
destructiveHint: false,
|
|
53
|
-
idempotentHint: true,
|
|
54
|
-
openWorldHint: false,
|
|
55
|
-
},
|
|
56
|
-
}, async (params) => {
|
|
57
|
-
try {
|
|
58
|
-
const result = await validateTagged(params.file_path);
|
|
59
|
-
const raw = params.response_format === ResponseFormat.JSON
|
|
60
|
-
? JSON.stringify(result, null, 2)
|
|
61
|
-
: formatTaggedValidationMarkdown(result);
|
|
62
|
-
const { text } = truncateIfNeeded(raw);
|
|
63
|
-
return { content: [{ type: 'text', text }] };
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
const err = handleStructuredError(error);
|
|
67
|
-
return {
|
|
68
|
-
content: [{ type: 'text', text: JSON.stringify(err, null, 2) }],
|
|
69
|
-
isError: true,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=validate-tagged.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-tagged.js","sourceRoot":"","sources":["../../../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