@shuji-bonji/pdf-reader-mcp 0.16.0 → 0.17.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 +54 -0
- 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/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 +6 -83
- package/dist/utils/formatter.js.map +1 -1
- package/package.json +4 -2
- 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,73 +0,0 @@
|
|
|
1
|
-
import { ResponseFormat } from '../../constants.js';
|
|
2
|
-
import { ValidateMetadataSchema } from '../../schemas/tier3.js';
|
|
3
|
-
import { validateMetadata } from '../../services/validation-service.js';
|
|
4
|
-
import { handleStructuredError } from '../../utils/error-handler.js';
|
|
5
|
-
import { formatMetadataValidationMarkdown, truncateIfNeeded } from '../../utils/formatter.js';
|
|
6
|
-
export function registerValidateMetadata(server) {
|
|
7
|
-
server.registerTool('validate_metadata', {
|
|
8
|
-
title: 'Validate PDF Metadata (deprecated)',
|
|
9
|
-
description: `[DEPRECATED — will be removed in the next major version]
|
|
10
|
-
|
|
11
|
-
For standards conformance, prefer pdf-verify-mcp's \`validate_conformance\`
|
|
12
|
-
(\`flavour: "pdfua-1"\` / \`"pdfa-*"\`), which judges against the ISO text and delegates to
|
|
13
|
-
veraPDF when available. Use \`get_metadata\` here if you just want to read metadata fields.
|
|
14
|
-
|
|
15
|
-
Reason: the family boundary is "pass/fail against an ISO standard belongs to pdf-verify-mcp;
|
|
16
|
-
reporting observations belongs to pdf-reader-mcp". This tool predates pdf-verify-mcp.
|
|
17
|
-
|
|
18
|
-
Known limitation (not being fixed — superseded): the checks read the document information
|
|
19
|
-
dictionary only. PDF/UA-1 §7.1 requires \`dc:title\` in the XMP metadata stream and states a
|
|
20
|
-
conforming reader "shall ignore" the Info dictionary; it also requires
|
|
21
|
-
\`ViewerPreferences/DisplayDocTitle = true\` and \`Suspects = false\`, none of which are checked
|
|
22
|
-
here. ISO 32000-2 §14.3.3 deprecates the Info dictionary except CreationDate/ModDate.
|
|
23
|
-
Treat the results below as general best-practice hints, not PDF/UA or PDF/A grounds.
|
|
24
|
-
|
|
25
|
-
Validate PDF metadata conformance against best practices and specification requirements.
|
|
26
|
-
|
|
27
|
-
Args:
|
|
28
|
-
- file_path (string): Absolute path to a local PDF file
|
|
29
|
-
- response_format ('markdown' | 'json'): Output format (default: 'markdown')
|
|
30
|
-
|
|
31
|
-
Returns:
|
|
32
|
-
Validation results including: total checks, pass/fail counts, detailed issues with severity, metadata field presence summary, and an overall summary.
|
|
33
|
-
|
|
34
|
-
Checks performed (all against the Info dictionary — see the limitation above):
|
|
35
|
-
- Title presence (best practice; NOT the PDF/UA basis, which is XMP dc:title)
|
|
36
|
-
- Author presence
|
|
37
|
-
- Creation date format validation
|
|
38
|
-
- Modification date presence
|
|
39
|
-
- Producer identification
|
|
40
|
-
- PDF version detection
|
|
41
|
-
- Tagged flag status
|
|
42
|
-
- Subject and Keywords presence
|
|
43
|
-
- Encryption and accessibility impact
|
|
44
|
-
|
|
45
|
-
Examples:
|
|
46
|
-
- Quick check of document metadata completeness for publishing standards
|
|
47
|
-
- (For PDF/A archival or PDF/UA compliance, use pdf-verify-mcp validate_conformance instead)`,
|
|
48
|
-
inputSchema: ValidateMetadataSchema,
|
|
49
|
-
annotations: {
|
|
50
|
-
readOnlyHint: true,
|
|
51
|
-
destructiveHint: false,
|
|
52
|
-
idempotentHint: true,
|
|
53
|
-
openWorldHint: false,
|
|
54
|
-
},
|
|
55
|
-
}, async (params) => {
|
|
56
|
-
try {
|
|
57
|
-
const result = await validateMetadata(params.file_path);
|
|
58
|
-
const raw = params.response_format === ResponseFormat.JSON
|
|
59
|
-
? JSON.stringify(result, null, 2)
|
|
60
|
-
: formatMetadataValidationMarkdown(result);
|
|
61
|
-
const { text } = truncateIfNeeded(raw);
|
|
62
|
-
return { content: [{ type: 'text', text }] };
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
const err = handleStructuredError(error);
|
|
66
|
-
return {
|
|
67
|
-
content: [{ type: 'text', text: JSON.stringify(err, null, 2) }],
|
|
68
|
-
isError: true,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=validate-metadata.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-metadata.js","sourceRoot":"","sources":["../../../src/tools/tier3/validate-metadata.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAA8B,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC5F,OAAO,E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;gBACxE,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-tagged.d.ts","sourceRoot":"","sources":["../../../src/tools/tier3/validate-tagged.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAO9D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAyE9D"}
|
|
@@ -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":["../../../src/tools/tier3/validate-tagged.ts"],"names":[],"mappings":"AAIA,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,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,8BAA8B,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5F,MAAM,UAAU,sBAAsB,CAAC,MAAiB;IACtD,MAAM,CAAC,YAAY,CACjB,iBAAiB,EACjB;QACE,KAAK,EAAE,kCAAkC;QACzC,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CAuCuB;QACpC,WAAW,EAAE,oBAAoB;QACjC,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF,EACD,KAAK,EAAE,MAA2B,EAAE,EAAE;QACpC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAEtD,MAAM,GAAG,GACP,MAAM,CAAC,eAAe,KAAK,cAAc,CAAC,IAAI;gBAC5C,CAAC,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