@shuji-bonji/pdf-spec-mcp 0.3.2 → 0.4.2
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/README.ja.md +11 -4
- package/README.md +11 -4
- package/dist/config.d.ts +22 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +32 -1
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +69 -5
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +70 -9
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -42
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +18 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +59 -0
- package/dist/server.js.map +1 -0
- package/dist/services/compare-service.d.ts +1 -1
- package/dist/services/compare-service.d.ts.map +1 -1
- package/dist/services/compare-service.js +2 -2
- package/dist/services/compare-service.js.map +1 -1
- package/dist/services/content-extractor.d.ts +65 -0
- package/dist/services/content-extractor.d.ts.map +1 -1
- package/dist/services/content-extractor.js +142 -10
- package/dist/services/content-extractor.js.map +1 -1
- package/dist/services/outline-resolver.d.ts +1 -1
- package/dist/services/outline-resolver.d.ts.map +1 -1
- package/dist/services/pdf-loader.d.ts +12 -2
- package/dist/services/pdf-loader.d.ts.map +1 -1
- package/dist/services/pdf-loader.js +21 -13
- package/dist/services/pdf-loader.js.map +1 -1
- package/dist/services/pdf-registry.d.ts.map +1 -1
- package/dist/services/pdf-registry.js +16 -8
- package/dist/services/pdf-registry.js.map +1 -1
- package/dist/services/pdf-service.d.ts +13 -1
- package/dist/services/pdf-service.d.ts.map +1 -1
- package/dist/services/pdf-service.js +79 -72
- package/dist/services/pdf-service.js.map +1 -1
- package/dist/services/requirement-extractor.d.ts +1 -1
- package/dist/services/requirement-extractor.d.ts.map +1 -1
- package/dist/services/requirement-extractor.js +40 -4
- package/dist/services/requirement-extractor.js.map +1 -1
- package/dist/services/search-index.d.ts +8 -1
- package/dist/services/search-index.d.ts.map +1 -1
- package/dist/services/search-index.js +48 -18
- package/dist/services/search-index.js.map +1 -1
- package/dist/services/table-collector.d.ts +19 -0
- package/dist/services/table-collector.d.ts.map +1 -0
- package/dist/services/table-collector.js +106 -0
- package/dist/services/table-collector.js.map +1 -0
- package/dist/tools/definitions.d.ts +26 -3
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/definitions.js +47 -114
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/handlers.d.ts +18 -9
- package/dist/tools/handlers.d.ts.map +1 -1
- package/dist/tools/handlers.js +57 -38
- package/dist/tools/handlers.js.map +1 -1
- package/dist/types/index.d.ts +28 -33
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/cache.d.ts.map +1 -1
- package/dist/utils/cache.js +4 -0
- package/dist/utils/cache.js.map +1 -1
- package/dist/utils/stdout-guard.d.ts +24 -0
- package/dist/utils/stdout-guard.d.ts.map +1 -0
- package/dist/utils/stdout-guard.js +27 -0
- package/dist/utils/stdout-guard.js.map +1 -0
- package/dist/utils/validation.d.ts +96 -14
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +152 -94
- package/dist/utils/validation.js.map +1 -1
- package/package.json +14 -11
- package/dist/container.d.ts +0 -25
- package/dist/container.d.ts.map +0 -1
- package/dist/container.js +0 -25
- package/dist/container.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-index.js","sourceRoot":"","sources":["../../src/services/search-index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"search-index.js","sourceRoot":"","sources":["../../src/services/search-index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C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AACH,SAAS,oBAAoB,CAC3B,QAAgB,EAChB,aAAqB,EACrB,WAAmB;IAEnB,4DAA4D;IAC5D,IAAI,aAAa,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,aAAa,GAAG,WAAW,CAAC,MAAM,CAAC;IACjD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CACzB,YAA0B,EAC1B,IAAY;IAEZ,8CAA8C;IAC9C,MAAM,IAAI,GAAG,YAAY,CAAC,SAAS,CAAC;IACpC,IAAI,MAA6C,CAAC;IAElD,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;QACxB,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;YACtB,MAAM,GAAG,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC;QACjD,CAAC;aAAM,CAAC;YACN,MAAM;QACR,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table Collector
|
|
3
|
+
* Turns StructTree-extracted content into logical tables.
|
|
4
|
+
*
|
|
5
|
+
* Shared so that get_tables and get_requirements agree on what a table *is* — its caption
|
|
6
|
+
* and where it ends. A table split across pages arrives as several `table` elements; only
|
|
7
|
+
* this module knows how to put them back together, and its rules (caption detection,
|
|
8
|
+
* continuation merging) must not be restated elsewhere.
|
|
9
|
+
*/
|
|
10
|
+
import type { ContentElement, TableInfo } from '../types/index.js';
|
|
11
|
+
/**
|
|
12
|
+
* Collect tables from StructTree-extracted content (type: 'table').
|
|
13
|
+
*
|
|
14
|
+
* Note this deliberately ignores text-detected tables (see detectTablesFromText): those are
|
|
15
|
+
* built out of `paragraph` elements, which prose scanners already read. Requirements must
|
|
16
|
+
* come from here only, or the same sentence would be counted twice.
|
|
17
|
+
*/
|
|
18
|
+
export declare function collectStructTreeTables(content: ContentElement[]): TableInfo[];
|
|
19
|
+
//# sourceMappingURL=table-collector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-collector.d.ts","sourceRoot":"","sources":["../../src/services/table-collector.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAgB,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEjF;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,SAAS,EAAE,CAmE9E"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table Collector
|
|
3
|
+
* Turns StructTree-extracted content into logical tables.
|
|
4
|
+
*
|
|
5
|
+
* Shared so that get_tables and get_requirements agree on what a table *is* — its caption
|
|
6
|
+
* and where it ends. A table split across pages arrives as several `table` elements; only
|
|
7
|
+
* this module knows how to put them back together, and its rules (caption detection,
|
|
8
|
+
* continuation merging) must not be restated elsewhere.
|
|
9
|
+
*/
|
|
10
|
+
import { TABLE_CAPTION_START_RE } from '../config.js';
|
|
11
|
+
/**
|
|
12
|
+
* Collect tables from StructTree-extracted content (type: 'table').
|
|
13
|
+
*
|
|
14
|
+
* Note this deliberately ignores text-detected tables (see detectTablesFromText): those are
|
|
15
|
+
* built out of `paragraph` elements, which prose scanners already read. Requirements must
|
|
16
|
+
* come from here only, or the same sentence would be counted twice.
|
|
17
|
+
*/
|
|
18
|
+
export function collectStructTreeTables(content) {
|
|
19
|
+
const tables = [];
|
|
20
|
+
// Content index of the last `table` element folded into `tables`, so the headerless
|
|
21
|
+
// rule below can demand adjacency. A page break splits one table into consecutive
|
|
22
|
+
// `table` elements; an intervening paragraph means the next table is a different one
|
|
23
|
+
// (8.7.4.5.5: the Mesh 2 flag list must not be merged into Mesh 1's).
|
|
24
|
+
let lastTableElementIndex = -1;
|
|
25
|
+
for (let i = 0; i < content.length; i++) {
|
|
26
|
+
const element = content[i];
|
|
27
|
+
if (element.type !== 'table')
|
|
28
|
+
continue;
|
|
29
|
+
// Check for caption in preceding paragraph
|
|
30
|
+
let caption = null;
|
|
31
|
+
if (i > 0) {
|
|
32
|
+
const prev = content[i - 1];
|
|
33
|
+
if (prev.type === 'paragraph' && TABLE_CAPTION_START_RE.test(prev.text)) {
|
|
34
|
+
caption = prev.text;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (!caption && tables.length > 0) {
|
|
38
|
+
const last = tables[tables.length - 1];
|
|
39
|
+
// Continuation, form 1: the header row is repeated (ISO restates it when a table
|
|
40
|
+
// resumes on a new page). Matching headers identify the fragment regardless of
|
|
41
|
+
// whatever lies between (the repeated header row itself is dropped).
|
|
42
|
+
if (element.headers.length > 0 && arraysEqual(last.headers, element.headers)) {
|
|
43
|
+
last.rows.push(...element.rows.map((row) => [...row]));
|
|
44
|
+
lastTableElementIndex = i;
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
// Continuation, form 2 (S-4): the fragment carries no usable header — either none
|
|
48
|
+
// at all, or one whose cells are all blank (image-only rows extract as ""). Headers
|
|
49
|
+
// cannot identify it, so instead require that it directly follows the previous
|
|
50
|
+
// fragment and has the same column count. A blank header row is dropped like a
|
|
51
|
+
// repeated one: whether it was a restated header or an image-only row, it holds no
|
|
52
|
+
// text either way.
|
|
53
|
+
if (i === lastTableElementIndex + 1 &&
|
|
54
|
+
isEffectivelyHeaderless(element) &&
|
|
55
|
+
columnCountOf(element.headers, element.rows) === columnCountOf(last.headers, last.rows)) {
|
|
56
|
+
last.rows.push(...element.rows.map((row) => [...row]));
|
|
57
|
+
lastTableElementIndex = i;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
tables.push({
|
|
62
|
+
index: tables.length,
|
|
63
|
+
caption,
|
|
64
|
+
// Copy, never alias — and copy continuation rows too (above). `content` is the
|
|
65
|
+
// section content cache: handing out a reference to `element.rows` and then pushing
|
|
66
|
+
// into it rewrites the cached page itself, so every later call sees a table that
|
|
67
|
+
// has grown. get_tables followed by get_requirements returned 4 table requirements,
|
|
68
|
+
// then 7, then 10 — the tool is declared idempotent and read-only, and this made it
|
|
69
|
+
// neither. Inner row arrays alias the cache just the same: a caller editing a cell
|
|
70
|
+
// of the result must not reach the cached page.
|
|
71
|
+
headers: [...element.headers],
|
|
72
|
+
rows: element.rows.map((row) => [...row]),
|
|
73
|
+
});
|
|
74
|
+
lastTableElementIndex = i;
|
|
75
|
+
}
|
|
76
|
+
return tables;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A table fragment that headers cannot identify: none at all, or all cells blank.
|
|
80
|
+
* (Image-only header rows extract as empty strings — 8.4.3.4 / 10.6.3.)
|
|
81
|
+
*/
|
|
82
|
+
function isEffectivelyHeaderless(element) {
|
|
83
|
+
return element.headers.length === 0 || element.headers.every((h) => h.trim() === '');
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Column count of a table or fragment: header width when there is a header row,
|
|
87
|
+
* otherwise the width of the first data row.
|
|
88
|
+
*/
|
|
89
|
+
function columnCountOf(headers, rows) {
|
|
90
|
+
if (headers.length > 0)
|
|
91
|
+
return headers.length;
|
|
92
|
+
return rows[0]?.length ?? 0;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Check if two string arrays are equal
|
|
96
|
+
*/
|
|
97
|
+
function arraysEqual(a, b) {
|
|
98
|
+
if (a.length !== b.length)
|
|
99
|
+
return false;
|
|
100
|
+
for (let i = 0; i < a.length; i++) {
|
|
101
|
+
if (a[i] !== b[i])
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=table-collector.js.map
|
|
@@ -0,0 +1 @@
|
|
|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,OAAqB;IACpD,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AACvF,CAAC;AAED;;;GAGG;AACH,SAAS,aAAa,CAAC,OAAiB,EAAE,IAAgB;IACxD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC;IAC9C,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,CAAW,EAAE,CAAW;IAC3C,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IAClC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MCP Tool Definitions
|
|
2
|
+
* MCP Tool Definitions (A-4: the registry behind McpServer + registerTool)
|
|
3
|
+
*
|
|
4
|
+
* Input schemas are derived from the Zod shapes in utils/validation.ts — the published
|
|
5
|
+
* schema and the runtime check have one source. Implementations live in handlers.ts.
|
|
6
|
+
*
|
|
7
|
+
* annotations (規約 §2.1):
|
|
8
|
+
* - readOnlyHint: true for every tool. This server only reads specification PDFs; nothing
|
|
9
|
+
* it exposes can alter the corpus or any other state.
|
|
10
|
+
* - destructiveHint / idempotentHint: reads are neither destructive nor
|
|
11
|
+
* state-dependent — the same arguments always yield the same answer for a given corpus.
|
|
12
|
+
* - openWorldHint: false. Answers come from PDFs on disk, not from the network.
|
|
3
13
|
*/
|
|
4
|
-
import type {
|
|
5
|
-
export
|
|
14
|
+
import type { ZodRawShape } from 'zod';
|
|
15
|
+
export interface ToolAnnotations {
|
|
16
|
+
readOnlyHint: boolean;
|
|
17
|
+
destructiveHint: boolean;
|
|
18
|
+
idempotentHint: boolean;
|
|
19
|
+
openWorldHint: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ToolDefinition {
|
|
22
|
+
name: string;
|
|
23
|
+
title: string;
|
|
24
|
+
description: string;
|
|
25
|
+
shape: ZodRawShape;
|
|
26
|
+
annotations: ToolAnnotations;
|
|
27
|
+
}
|
|
28
|
+
export declare const tools: ToolDefinition[];
|
|
6
29
|
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAYvC,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,WAAW,CAAC;IACnB,WAAW,EAAE,eAAe,CAAC;CAC9B;AAUD,eAAO,MAAM,KAAK,EAAE,cAAc,EA2FjC,CAAC"}
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MCP Tool Definitions
|
|
2
|
+
* MCP Tool Definitions (A-4: the registry behind McpServer + registerTool)
|
|
3
|
+
*
|
|
4
|
+
* Input schemas are derived from the Zod shapes in utils/validation.ts — the published
|
|
5
|
+
* schema and the runtime check have one source. Implementations live in handlers.ts.
|
|
6
|
+
*
|
|
7
|
+
* annotations (規約 §2.1):
|
|
8
|
+
* - readOnlyHint: true for every tool. This server only reads specification PDFs; nothing
|
|
9
|
+
* it exposes can alter the corpus or any other state.
|
|
10
|
+
* - destructiveHint / idempotentHint: reads are neither destructive nor
|
|
11
|
+
* state-dependent — the same arguments always yield the same answer for a given corpus.
|
|
12
|
+
* - openWorldHint: false. Answers come from PDFs on disk, not from the network.
|
|
3
13
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
import { compareVersionsShape, getDefinitionsShape, getRequirementsShape, getSectionShape, getStructureShape, getTablesShape, listSpecsShape, searchSpecShape, } from '../utils/validation.js';
|
|
15
|
+
/** Every tool in this server reads; none of them writes or reaches the network. */
|
|
16
|
+
const READ_ONLY = {
|
|
17
|
+
readOnlyHint: true,
|
|
18
|
+
destructiveHint: false,
|
|
19
|
+
idempotentHint: true,
|
|
20
|
+
openWorldHint: false,
|
|
9
21
|
};
|
|
10
22
|
export const tools = [
|
|
11
23
|
// ========================================
|
|
@@ -13,158 +25,79 @@ export const tools = [
|
|
|
13
25
|
// ========================================
|
|
14
26
|
{
|
|
15
27
|
name: 'list_specs',
|
|
28
|
+
title: 'List available specifications',
|
|
16
29
|
description: 'List all available PDF specification documents. ' +
|
|
17
30
|
'Returns document IDs, titles, page counts, and categories. ' +
|
|
18
31
|
'Use the returned IDs as the `spec` parameter in other tools.',
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
properties: {
|
|
22
|
-
category: {
|
|
23
|
-
type: 'string',
|
|
24
|
-
description: 'Filter by document category.',
|
|
25
|
-
enum: ['standard', 'ts', 'pdfua', 'guide', 'appnote'],
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
32
|
+
shape: listSpecsShape,
|
|
33
|
+
annotations: READ_ONLY,
|
|
29
34
|
},
|
|
30
|
-
// ========================================
|
|
31
|
-
// Structure & Content
|
|
32
|
-
// ========================================
|
|
33
35
|
{
|
|
34
36
|
name: 'get_structure',
|
|
37
|
+
title: 'Get section hierarchy',
|
|
35
38
|
description: 'Get the section hierarchy of the PDF specification (ISO 32000-2). ' +
|
|
36
39
|
'Returns the table of contents with section numbers, titles, and page numbers.',
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
properties: {
|
|
40
|
-
spec: SPEC_PARAM,
|
|
41
|
-
max_depth: {
|
|
42
|
-
type: 'number',
|
|
43
|
-
description: 'Maximum depth of the hierarchy to return (default: all levels). ' +
|
|
44
|
-
'1 = top-level only, 2 = top + sub-sections, etc.',
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
40
|
+
shape: getStructureShape,
|
|
41
|
+
annotations: READ_ONLY,
|
|
48
42
|
},
|
|
43
|
+
// ========================================
|
|
44
|
+
// Reading
|
|
45
|
+
// ========================================
|
|
49
46
|
{
|
|
50
47
|
name: 'get_section',
|
|
48
|
+
title: 'Get section content',
|
|
51
49
|
description: 'Get the content of a specific section from the PDF specification (ISO 32000-2). ' +
|
|
52
50
|
'Returns structured content including headings, paragraphs, lists, tables, and notes.',
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
properties: {
|
|
56
|
-
spec: SPEC_PARAM,
|
|
57
|
-
section: {
|
|
58
|
-
type: 'string',
|
|
59
|
-
description: 'Section identifier (e.g., "7.3.4", "12.8", "Annex A", "Foreword")',
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
required: ['section'],
|
|
63
|
-
},
|
|
51
|
+
shape: getSectionShape,
|
|
52
|
+
annotations: READ_ONLY,
|
|
64
53
|
},
|
|
65
|
-
// ========================================
|
|
66
|
-
// Search
|
|
67
|
-
// ========================================
|
|
68
54
|
{
|
|
69
55
|
name: 'search_spec',
|
|
56
|
+
title: 'Search the specification',
|
|
70
57
|
description: 'Search the PDF specification (ISO 32000-2) for a keyword or phrase. ' +
|
|
71
58
|
'Returns matching sections with context snippets. ' +
|
|
72
59
|
'The first call may take a few seconds to build the search index.',
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
properties: {
|
|
76
|
-
spec: SPEC_PARAM,
|
|
77
|
-
query: {
|
|
78
|
-
type: 'string',
|
|
79
|
-
description: 'Search query (keyword or phrase)',
|
|
80
|
-
},
|
|
81
|
-
max_results: {
|
|
82
|
-
type: 'number',
|
|
83
|
-
description: 'Maximum number of results to return (default: 10, max: 50)',
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
required: ['query'],
|
|
87
|
-
},
|
|
60
|
+
shape: searchSpecShape,
|
|
61
|
+
annotations: READ_ONLY,
|
|
88
62
|
},
|
|
89
63
|
// ========================================
|
|
90
|
-
//
|
|
64
|
+
// Structured extraction
|
|
91
65
|
// ========================================
|
|
92
66
|
{
|
|
93
67
|
name: 'get_requirements',
|
|
68
|
+
title: 'Extract normative requirements',
|
|
94
69
|
description: 'Extract normative requirements (shall/must/may) from the PDF specification (ISO 32000-2). ' +
|
|
95
70
|
'Returns structured requirements with the sentence context, section, and requirement level.',
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
properties: {
|
|
99
|
-
spec: SPEC_PARAM,
|
|
100
|
-
section: {
|
|
101
|
-
type: 'string',
|
|
102
|
-
description: 'Filter by section number (e.g., "7.3.4", "12.8"). ' +
|
|
103
|
-
'Includes subsections. If omitted, scans all sections (slower on first call).',
|
|
104
|
-
},
|
|
105
|
-
level: {
|
|
106
|
-
type: 'string',
|
|
107
|
-
description: 'Filter by requirement level.',
|
|
108
|
-
enum: ['shall', 'shall not', 'should', 'should not', 'may'],
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
},
|
|
71
|
+
shape: getRequirementsShape,
|
|
72
|
+
annotations: READ_ONLY,
|
|
112
73
|
},
|
|
113
74
|
{
|
|
114
75
|
name: 'get_definitions',
|
|
76
|
+
title: 'Get term definitions',
|
|
115
77
|
description: 'Get term definitions from Section 3 of the PDF specification (ISO 32000-2). ' +
|
|
116
78
|
'Returns structured definitions with term, definition text, notes, and sources.',
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
properties: {
|
|
120
|
-
spec: SPEC_PARAM,
|
|
121
|
-
term: {
|
|
122
|
-
type: 'string',
|
|
123
|
-
description: 'Search for a specific term by keyword (case-insensitive substring match). ' +
|
|
124
|
-
'If omitted, returns all definitions.',
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
},
|
|
79
|
+
shape: getDefinitionsShape,
|
|
80
|
+
annotations: READ_ONLY,
|
|
128
81
|
},
|
|
129
82
|
{
|
|
130
83
|
name: 'get_tables',
|
|
84
|
+
title: 'Extract tables',
|
|
131
85
|
description: 'Extract table structures from a specified section of the PDF specification (ISO 32000-2). ' +
|
|
132
86
|
'Returns tables with headers, rows, and optional captions.',
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
properties: {
|
|
136
|
-
spec: SPEC_PARAM,
|
|
137
|
-
section: {
|
|
138
|
-
type: 'string',
|
|
139
|
-
description: 'Section identifier (e.g., "7.3.4", "12.8", "Annex A")',
|
|
140
|
-
},
|
|
141
|
-
table_index: {
|
|
142
|
-
type: 'number',
|
|
143
|
-
description: 'Optional 0-based index to retrieve a specific table. ' +
|
|
144
|
-
'If omitted, returns all tables in the section.',
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
required: ['section'],
|
|
148
|
-
},
|
|
87
|
+
shape: getTablesShape,
|
|
88
|
+
annotations: READ_ONLY,
|
|
149
89
|
},
|
|
150
90
|
// ========================================
|
|
151
|
-
//
|
|
91
|
+
// Comparison
|
|
152
92
|
// ========================================
|
|
153
93
|
{
|
|
154
94
|
name: 'compare_versions',
|
|
95
|
+
title: 'Compare PDF 1.7 and PDF 2.0',
|
|
155
96
|
description: 'Compare sections between PDF 1.7 (ISO 32000-1) and PDF 2.0 (ISO 32000-2). ' +
|
|
156
97
|
'Returns matched sections (same or moved), added sections (new in 2.0), ' +
|
|
157
98
|
'and removed sections (absent in 2.0). Uses title-based automatic matching.',
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
properties: {
|
|
161
|
-
section: {
|
|
162
|
-
type: 'string',
|
|
163
|
-
description: 'Compare a specific section and its subsections (e.g., "12.8" for Digital Signatures). ' +
|
|
164
|
-
'Uses PDF 2.0 section numbering. If omitted, compares all top-level sections.',
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
},
|
|
99
|
+
shape: compareVersionsShape,
|
|
100
|
+
annotations: READ_ONLY,
|
|
168
101
|
},
|
|
169
102
|
];
|
|
170
103
|
//# sourceMappingURL=definitions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAiBhC,mFAAmF;AACnF,MAAM,SAAS,GAAoB;IACjC,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,KAAK;IACtB,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,KAAK;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAqB;IACrC,2CAA2C;IAC3C,YAAY;IACZ,2CAA2C;IAC3C;QACE,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,+BAA+B;QACtC,WAAW,EACT,kDAAkD;YAClD,6DAA6D;YAC7D,8DAA8D;QAChE,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,SAAS;KACvB;IACD;QACE,IA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/dist/tools/handlers.d.ts
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MCP Tool Handlers
|
|
3
|
+
*
|
|
4
|
+
* Adding a tool takes three edits:
|
|
5
|
+
* 1. a Zod shape + schema in utils/validation.ts
|
|
6
|
+
* 2. one entry in the definitions.ts registry
|
|
7
|
+
* 3. a handleXxx here, plus a line in toolHandlers
|
|
8
|
+
*
|
|
9
|
+
* Every handler parses its arguments with parseArgs before doing anything. The SDK also
|
|
10
|
+
* checks the published shape, but handlers are called directly in tests too, and parseArgs
|
|
11
|
+
* is what turns a bad argument into the family's structured VALIDATION_ERROR.
|
|
3
12
|
*/
|
|
4
|
-
import type {
|
|
5
|
-
declare function handleListSpecs(
|
|
6
|
-
declare function handleGetStructure(
|
|
7
|
-
declare function handleGetSection(
|
|
8
|
-
declare function handleSearchSpec(
|
|
13
|
+
import type { ListSpecsResult, StructureResult } from '../types/index.js';
|
|
14
|
+
declare function handleListSpecs(rawArgs: unknown): Promise<ListSpecsResult>;
|
|
15
|
+
declare function handleGetStructure(rawArgs: unknown): Promise<StructureResult>;
|
|
16
|
+
declare function handleGetSection(rawArgs: unknown): Promise<import("../types/index.js").SectionResult>;
|
|
17
|
+
declare function handleSearchSpec(rawArgs: unknown): Promise<{
|
|
9
18
|
query: string;
|
|
10
19
|
totalResults: number;
|
|
11
20
|
results: import("../types/index.js").SearchHit[];
|
|
12
21
|
}>;
|
|
13
|
-
declare function handleGetRequirements(
|
|
14
|
-
declare function handleGetDefinitions(
|
|
15
|
-
declare function handleGetTables(
|
|
16
|
-
declare function handleCompareVersions(
|
|
22
|
+
declare function handleGetRequirements(rawArgs: unknown): Promise<import("../types/index.js").RequirementsResult>;
|
|
23
|
+
declare function handleGetDefinitions(rawArgs: unknown): Promise<import("../types/index.js").DefinitionsResult>;
|
|
24
|
+
declare function handleGetTables(rawArgs: unknown): Promise<import("../types/index.js").TablesResult>;
|
|
25
|
+
declare function handleCompareVersions(rawArgs: unknown): Promise<import("../types/index.js").CompareVersionsResult>;
|
|
17
26
|
/**
|
|
18
27
|
* Type-safe mapping from tool name to its handler.
|
|
19
28
|
* Each handler retains its specific argument and return types.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/tools/handlers.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/tools/handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAmBH,OAAO,KAAK,EACV,eAAe,EAGf,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAoB3B,iBAAe,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAgBzE;AAMD,iBAAe,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAe5E;AAMD,iBAAe,gBAAgB,CAAC,OAAO,EAAE,OAAO,sDAI/C;AAMD,iBAAe,gBAAgB,CAAC,OAAO,EAAE,OAAO;;;;GAW/C;AAgBD,iBAAe,qBAAqB,CAAC,OAAO,EAAE,OAAO,2DAKpD;AAMD,iBAAe,oBAAoB,CAAC,OAAO,EAAE,OAAO,0DAInD;AAMD,iBAAe,eAAe,CAAC,OAAO,EAAE,OAAO,qDAI9C;AAMD,iBAAe,qBAAqB,CAAC,OAAO,EAAE,OAAO,8DAqCpD;AAMD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;;;;;;;;;CASf,CAAC;AAEX,2CAA2C;AAC3C,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,YAAY,CAAC"}
|