@tiwater/office-mcp 0.17.28 → 0.17.30
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.
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"x-tiwater-file-role": "read"
|
|
9
9
|
},
|
|
10
10
|
"kinds": {
|
|
11
|
-
"description": "Open XML object kinds to list in native document order. Request paragraph and table together when their adjacency carries meaning. Returned parentRef is the valid targetParentRef for inserting beside that object.",
|
|
11
|
+
"description": "Open XML object kinds to list in native document order. Start at the selected story part, then follow returned refs through parentRef-scoped child pages. Request paragraph and table together when their adjacency carries meaning. Text previews describe already located objects; they do not identify a document or select a source. Returned parentRef is the valid targetParentRef for inserting beside that object.",
|
|
12
12
|
"type": "array",
|
|
13
13
|
"items": {
|
|
14
14
|
"type": "string",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"pattern": "^dox1_[0-9a-f]{64}$"
|
|
37
37
|
},
|
|
38
38
|
"limit": {
|
|
39
|
-
"description": "Maximum identities in this small page. Follow continuation
|
|
39
|
+
"description": "Maximum identities in this small page. Follow continuation in native order when the same structural inventory is required, then use returned refs to descend into the selected object.",
|
|
40
40
|
"default": 50,
|
|
41
41
|
"type": "integer",
|
|
42
42
|
"minimum": 1,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schema": "tiwater.office-provider-contract-manifest/v1",
|
|
3
3
|
"provider": {
|
|
4
4
|
"id": "@tiwater/office-mcp",
|
|
5
|
-
"version": "0.17.
|
|
5
|
+
"version": "0.17.30"
|
|
6
6
|
},
|
|
7
7
|
"tools": [
|
|
8
8
|
{
|
|
@@ -82,17 +82,6 @@
|
|
|
82
82
|
"sha256": "ecf528f83a28f2709efb12182dba18f5f4baf065e8442c76ab568ad01465603d"
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
|
-
{
|
|
86
|
-
"name": "docx_find_literal",
|
|
87
|
-
"providerContract": {
|
|
88
|
-
"source": "packages/docx-cli/contracts/mcp-input/docx_find_literal.schema.json",
|
|
89
|
-
"sha256": "4b063c8a4c683c1d7eb06ce1feec8e51546dca78759151ff654f41d45a17d64c"
|
|
90
|
-
},
|
|
91
|
-
"inputContract": {
|
|
92
|
-
"path": "office/contracts/docx_find_literal.schema.json",
|
|
93
|
-
"sha256": "4b063c8a4c683c1d7eb06ce1feec8e51546dca78759151ff654f41d45a17d64c"
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
85
|
{
|
|
97
86
|
"name": "docx_inspect",
|
|
98
87
|
"providerContract": {
|
|
@@ -108,11 +97,11 @@
|
|
|
108
97
|
"name": "docx_list_objects",
|
|
109
98
|
"providerContract": {
|
|
110
99
|
"source": "packages/docx-cli/contracts/mcp-input/docx_list_objects.schema.json",
|
|
111
|
-
"sha256": "
|
|
100
|
+
"sha256": "418e758c979a0a7dc8b7401091ac92efcf7ea53b77ceb263746588fcd546a0c8"
|
|
112
101
|
},
|
|
113
102
|
"inputContract": {
|
|
114
103
|
"path": "office/contracts/docx_list_objects.schema.json",
|
|
115
|
-
"sha256": "
|
|
104
|
+
"sha256": "418e758c979a0a7dc8b7401091ac92efcf7ea53b77ceb263746588fcd546a0c8"
|
|
116
105
|
}
|
|
117
106
|
},
|
|
118
107
|
{
|
package/office/index.mjs
CHANGED
|
@@ -173,17 +173,6 @@ function docxInspectionOutput(tool) {
|
|
|
173
173
|
revision: docxRevision,
|
|
174
174
|
summary: z.object({
|
|
175
175
|
tableCount: z.number().int().nonnegative(),
|
|
176
|
-
tables: z.array(z.object({
|
|
177
|
-
ref: z.string().regex(/^dox1_[0-9a-f]{64}$/),
|
|
178
|
-
parentRef: z.string().regex(/^dox1_[0-9a-f]{64}$/).nullable(),
|
|
179
|
-
rowCount: z.number().int().nonnegative(),
|
|
180
|
-
columnCount: z.number().int().nonnegative(),
|
|
181
|
-
textPreview: z.string().max(240),
|
|
182
|
-
contextBefore: z.array(z.object({
|
|
183
|
-
ref: z.string().regex(/^dox1_[0-9a-f]{64}$/),
|
|
184
|
-
textPreview: z.string().min(1).max(240),
|
|
185
|
-
}).strict()).max(3),
|
|
186
|
-
}).strict()),
|
|
187
176
|
openingParagraphs: z.array(z.object({
|
|
188
177
|
ref: z.string().regex(/^dox1_[0-9a-f]{64}$/),
|
|
189
178
|
textPreview: z.string().min(1).max(240),
|
|
@@ -216,7 +205,7 @@ const docxObservationNode = z.lazy(() => z.object({
|
|
|
216
205
|
|
|
217
206
|
const docxObservationReceipt = z.object({
|
|
218
207
|
schema: z.literal('tiwater.docx-observation-receipt/v1'),
|
|
219
|
-
operation: z.
|
|
208
|
+
operation: z.literal('list'),
|
|
220
209
|
revision: docxRevision,
|
|
221
210
|
totalCount: z.number().int().nonnegative(),
|
|
222
211
|
returnedCount: z.number().int().nonnegative(),
|
|
@@ -231,19 +220,6 @@ const docxListObjectsOutput = artifactOutput('docx_list_objects').extend({
|
|
|
231
220
|
runtime: runtimeIdentity,
|
|
232
221
|
}).strict();
|
|
233
222
|
|
|
234
|
-
const docxFindLiteralOutput = artifactOutput('docx_find_literal').extend({
|
|
235
|
-
schema: z.literal('tiwater.docx-observation-find/v1'),
|
|
236
|
-
receipt: docxObservationReceipt,
|
|
237
|
-
matches: z.array(z.object({
|
|
238
|
-
object: docxObjectIdentity,
|
|
239
|
-
matches: z.array(z.object({
|
|
240
|
-
offset: z.number().int().nonnegative(),
|
|
241
|
-
length: z.number().int().positive(),
|
|
242
|
-
}).strict()),
|
|
243
|
-
}).strict()),
|
|
244
|
-
runtime: runtimeIdentity,
|
|
245
|
-
}).strict();
|
|
246
|
-
|
|
247
223
|
const docxReadObjectOutput = artifactOutput('docx_read_object').extend({
|
|
248
224
|
revision: docxRevision,
|
|
249
225
|
observation: docxObservationNode,
|
|
@@ -252,7 +228,7 @@ const docxReadObjectOutput = artifactOutput('docx_read_object').extend({
|
|
|
252
228
|
const tools = [
|
|
253
229
|
{
|
|
254
230
|
name: 'docx_inspect',
|
|
255
|
-
description: 'Inspect one current DOCX
|
|
231
|
+
description: 'Inspect one current DOCX and retain its complete machine observation at output. The response returns the current revision, observation artifact, table count, and up to six opening non-empty body paragraphs for document identity. Use list and read operations to traverse selected document objects in native structure order.',
|
|
256
232
|
inputSchema: inputContract('docx_inspect'),
|
|
257
233
|
outputSchema: docxInspectionOutput('docx_inspect'),
|
|
258
234
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
@@ -260,20 +236,12 @@ const tools = [
|
|
|
260
236
|
},
|
|
261
237
|
{
|
|
262
238
|
name: 'docx_list_objects',
|
|
263
|
-
description: 'List one small page of revision-bound nearest-child identities in native document order and retain the exact page at output for later reuse.
|
|
239
|
+
description: 'List one small page of revision-bound nearest-child identities in native document order and retain the exact page at output for later reuse. Start at the selected story part, follow continuation in order, and descend only through returned refs with parentRef. Request paragraph and table together when their adjacency carries meaning. Text previews describe already located objects; never use matching text to identify a document or select a source.',
|
|
264
240
|
inputSchema: inputContract('docx_list_objects'),
|
|
265
241
|
outputSchema: docxListObjectsOutput,
|
|
266
242
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
267
243
|
handler: args => docxObservation('docx_list_objects', args),
|
|
268
244
|
},
|
|
269
|
-
{
|
|
270
|
-
name: 'docx_find_literal',
|
|
271
|
-
description: 'Find exact current text in one small page of revision-bound native DOCX objects and retain the exact page at output for later reuse. With kind table or row, matching includes descendant cell text.',
|
|
272
|
-
inputSchema: inputContract('docx_find_literal'),
|
|
273
|
-
outputSchema: docxFindLiteralOutput,
|
|
274
|
-
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
275
|
-
handler: args => docxObservation('docx_find_literal', args),
|
|
276
|
-
},
|
|
277
245
|
{
|
|
278
246
|
name: 'docx_read_object',
|
|
279
247
|
description: 'Read one selected native DOCX row, cell, or paragraph and requested descendants. For a table, page its row identities with docx_list_objects, then read only the current row. To select exact inline content, make a second read rooted at the observed cell or paragraph and request run or text.',
|
|
@@ -528,34 +496,10 @@ function compactDocxInspection(report) {
|
|
|
528
496
|
ref: item.objectRef,
|
|
529
497
|
textPreview: item.text.trim().replace(/\s+/gu, ' ').slice(0, 240),
|
|
530
498
|
}));
|
|
531
|
-
const tableContexts = new Map();
|
|
532
|
-
let precedingParagraphs = [];
|
|
533
|
-
for (const item of report.flow) {
|
|
534
|
-
if (item?.type === 'paragraph' && /^dox1_[0-9a-f]{64}$/u.test(item.objectRef)
|
|
535
|
-
&& typeof item.text === 'string' && item.text.trim()) {
|
|
536
|
-
precedingParagraphs.push({
|
|
537
|
-
ref: item.objectRef,
|
|
538
|
-
textPreview: item.text.trim().replace(/\s+/gu, ' ').slice(0, 240),
|
|
539
|
-
});
|
|
540
|
-
precedingParagraphs = precedingParagraphs.slice(-3);
|
|
541
|
-
}
|
|
542
|
-
if (item?.type === 'table' && Number.isInteger(item.tableIndex)) {
|
|
543
|
-
tableContexts.set(item.tableIndex, precedingParagraphs);
|
|
544
|
-
precedingParagraphs = [];
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
499
|
return {
|
|
548
500
|
revision: report.tables.revision,
|
|
549
501
|
summary: {
|
|
550
502
|
tableCount: report.tables.tables.length,
|
|
551
|
-
tables: report.tables.tables.map((table, tableIndex) => ({
|
|
552
|
-
ref: table.ref,
|
|
553
|
-
parentRef: table.parentRef,
|
|
554
|
-
rowCount: table.rowCount,
|
|
555
|
-
columnCount: table.columnCount,
|
|
556
|
-
textPreview: String(table.textPreview ?? '').trim().replace(/\s+/gu, ' ').slice(0, 240),
|
|
557
|
-
contextBefore: tableContexts.get(tableIndex) ?? [],
|
|
558
|
-
})),
|
|
559
503
|
openingParagraphs,
|
|
560
504
|
},
|
|
561
505
|
};
|
|
@@ -620,16 +564,6 @@ async function docxObservation(tool, args) {
|
|
|
620
564
|
if (tool === 'docx_list_objects') {
|
|
621
565
|
return { ...retained, ...payload, objects: payload.objects.map(compactDocxObjectIdentity) };
|
|
622
566
|
}
|
|
623
|
-
if (tool === 'docx_find_literal') {
|
|
624
|
-
return {
|
|
625
|
-
...retained,
|
|
626
|
-
...payload,
|
|
627
|
-
matches: payload.matches.map(match => ({
|
|
628
|
-
object: compactDocxObjectIdentity(match.object),
|
|
629
|
-
matches: match.matches,
|
|
630
|
-
})),
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
567
|
throw new Error(`unsupported-docx-observation-tool:${tool}`);
|
|
634
568
|
});
|
|
635
569
|
}
|
package/package.json
CHANGED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"type": "object",
|
|
4
|
-
"properties": {
|
|
5
|
-
"input": {
|
|
6
|
-
"type": "string",
|
|
7
|
-
"minLength": 1,
|
|
8
|
-
"x-tiwater-file-role": "read"
|
|
9
|
-
},
|
|
10
|
-
"literal": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"minLength": 1
|
|
13
|
-
},
|
|
14
|
-
"kind": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"enum": [
|
|
17
|
-
"part",
|
|
18
|
-
"paragraph",
|
|
19
|
-
"table",
|
|
20
|
-
"gridColumn",
|
|
21
|
-
"row",
|
|
22
|
-
"cell",
|
|
23
|
-
"run",
|
|
24
|
-
"text",
|
|
25
|
-
"drawing"
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
"scope": {
|
|
29
|
-
"description": "Exact story-part URI such as /word/document.xml.",
|
|
30
|
-
"type": "string",
|
|
31
|
-
"minLength": 1
|
|
32
|
-
},
|
|
33
|
-
"parentRef": {
|
|
34
|
-
"description": "Optional revision-bound parent object ref. Searches only its nearest published child objects, not every recursive descendant.",
|
|
35
|
-
"type": "string",
|
|
36
|
-
"pattern": "^dox1_[0-9a-f]{64}$"
|
|
37
|
-
},
|
|
38
|
-
"limit": {
|
|
39
|
-
"description": "Maximum matches in this small page. Refine the literal or parentRef when more matches remain; do not raise the page size to extract the document.",
|
|
40
|
-
"default": 50,
|
|
41
|
-
"type": "integer",
|
|
42
|
-
"minimum": 1,
|
|
43
|
-
"maximum": 100
|
|
44
|
-
},
|
|
45
|
-
"continuation": {
|
|
46
|
-
"type": "string",
|
|
47
|
-
"minLength": 1
|
|
48
|
-
},
|
|
49
|
-
"output": {
|
|
50
|
-
"type": "string",
|
|
51
|
-
"minLength": 1,
|
|
52
|
-
"description": "Absolute path for a new JSON artifact containing this exact search page for later reuse.",
|
|
53
|
-
"x-tiwater-file-role": "write"
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
"required": [
|
|
57
|
-
"input",
|
|
58
|
-
"literal",
|
|
59
|
-
"output"
|
|
60
|
-
],
|
|
61
|
-
"additionalProperties": false,
|
|
62
|
-
"$id": "tiwater.office-mcp-input/docx_find_literal/v1"
|
|
63
|
-
}
|