@components-kit/open-workbook 0.1.2 → 0.1.3
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.md +3 -0
- package/assets/backend/dist/runtime-service.d.ts +132 -191
- package/assets/backend/dist/runtime-service.d.ts.map +1 -1
- package/assets/backend/dist/runtime-service.js +85 -8
- package/assets/backend/dist/runtime-service.js.map +1 -1
- package/assets/excel-addin/dist/connection.d.ts.map +1 -1
- package/assets/excel-addin/dist/connection.js +4 -1
- package/assets/excel-addin/dist/connection.js.map +1 -1
- package/assets/excel-addin/dist/excel-executor.d.ts +7 -2
- package/assets/excel-addin/dist/excel-executor.d.ts.map +1 -1
- package/assets/excel-addin/dist/excel-executor.js +204 -40
- package/assets/excel-addin/dist/excel-executor.js.map +1 -1
- package/assets/excel-addin/manifest.xml +1 -1
- package/assets/instructions/open-workbook-excel/references/tool-selection.md +4 -2
- package/assets/instructions/open-workbook-excel/references/workflows.md +7 -4
- package/assets/mcp-server/dist/index.js +72 -7
- package/assets/mcp-server/dist/index.js.map +1 -1
- package/dist/index.js +45 -34
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -45,7 +45,7 @@ const STYLE_COPY_TOOL_DIMENSIONS = {
|
|
|
45
45
|
"excel.style.copy_hidden_rows_columns": "hiddenRowsColumns"
|
|
46
46
|
};
|
|
47
47
|
const runtime = await createRuntimeFacade();
|
|
48
|
-
const runtimeVersion = process.env.OPEN_WORKBOOK_VERSION ?? "0.1.
|
|
48
|
+
const runtimeVersion = process.env.OPEN_WORKBOOK_VERSION ?? "0.1.3";
|
|
49
49
|
const server = new McpServer({
|
|
50
50
|
name: "open-workbook",
|
|
51
51
|
version: runtimeVersion
|
|
@@ -975,14 +975,14 @@ function registerRangeTools(mcp) {
|
|
|
975
975
|
]) {
|
|
976
976
|
registerMcpTool(mcp, name, {
|
|
977
977
|
title: name.replace(/^excel\./, "").replace(/\./g, " "),
|
|
978
|
-
description: "Read
|
|
978
|
+
description: "Read one range facet without loading unrelated cell payloads.",
|
|
979
979
|
inputSchema: readSchema,
|
|
980
980
|
annotations: {
|
|
981
981
|
readOnlyHint: true,
|
|
982
982
|
destructiveHint: false,
|
|
983
983
|
openWorldHint: false
|
|
984
984
|
}
|
|
985
|
-
}, async ({ workbookId, sheetName, address }) => jsonResult(await readRangeSnapshot(workbookId, sheetName, address)));
|
|
985
|
+
}, async ({ workbookId, sheetName, address }) => jsonResult(await readRangeSnapshot(workbookId, sheetName, address, rangeReadFacets(name))));
|
|
986
986
|
}
|
|
987
987
|
for (const [name, method] of [
|
|
988
988
|
["excel.range.read_hyperlinks", "range.read_hyperlinks"],
|
|
@@ -1952,10 +1952,19 @@ function registerTableTools(mcp) {
|
|
|
1952
1952
|
}, async (args) => jsonResult(await runtime.getTableInfo(tableSelector(args))));
|
|
1953
1953
|
registerMcpTool(mcp, "excel.table.read", {
|
|
1954
1954
|
title: "Read Excel table",
|
|
1955
|
-
description: "Read table headers,
|
|
1956
|
-
inputSchema:
|
|
1955
|
+
description: "Read table headers, selected data facets, optional columns, optional row page, and metadata.",
|
|
1956
|
+
inputSchema: {
|
|
1957
|
+
...tableSelectorSchema(),
|
|
1958
|
+
includeValues: z.boolean().optional(),
|
|
1959
|
+
includeFormulas: z.boolean().optional(),
|
|
1960
|
+
includeText: z.boolean().optional(),
|
|
1961
|
+
includeNumberFormats: z.boolean().optional(),
|
|
1962
|
+
columns: z.array(z.union([z.string(), z.number().int().min(0)])).optional(),
|
|
1963
|
+
rowOffset: z.number().int().min(0).optional(),
|
|
1964
|
+
rowLimit: z.number().int().min(0).optional()
|
|
1965
|
+
},
|
|
1957
1966
|
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false }
|
|
1958
|
-
}, async (args) => jsonResult(await runtime.readTable(
|
|
1967
|
+
}, async (args) => jsonResult(await runtime.readTable(tableReadRequest(args))));
|
|
1959
1968
|
registerMcpTool(mcp, "excel.table.create", {
|
|
1960
1969
|
title: "Create Excel table",
|
|
1961
1970
|
description: "Create a structured table from a range, optionally writing values first.",
|
|
@@ -1977,6 +1986,18 @@ function registerTableTools(mcp) {
|
|
|
1977
1986
|
inputSchema: { ...tableSelectorSchema(), address: z.string() },
|
|
1978
1987
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false }
|
|
1979
1988
|
}, async (args) => jsonResult(await runtime.resizeTable({ ...tableSelector(args), address: args.address })));
|
|
1989
|
+
registerMcpTool(mcp, "excel.table.reorder_columns", {
|
|
1990
|
+
title: "Reorder Excel table columns",
|
|
1991
|
+
description: "Reorder columns in an existing structured table without clearing or recreating the table.",
|
|
1992
|
+
inputSchema: {
|
|
1993
|
+
...tableSelectorSchema(),
|
|
1994
|
+
columnOrder: z.array(z.union([z.string(), z.number().int().min(0)]))
|
|
1995
|
+
},
|
|
1996
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false }
|
|
1997
|
+
}, async (args) => jsonResult(await runtime.reorderTableColumns({
|
|
1998
|
+
...tableSelector(args),
|
|
1999
|
+
columnOrder: args.columnOrder
|
|
2000
|
+
})));
|
|
1980
2001
|
registerMcpTool(mcp, "excel.table.append_rows", {
|
|
1981
2002
|
title: "Append Excel table rows",
|
|
1982
2003
|
description: "Append one or more rows to a structured table.",
|
|
@@ -3252,7 +3273,23 @@ function registerEventTools(mcp) {
|
|
|
3252
3273
|
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false }
|
|
3253
3274
|
}, async ({ debounceMs }) => jsonResult(runtime.setEventDebounce(debounceMs)));
|
|
3254
3275
|
}
|
|
3255
|
-
|
|
3276
|
+
function rangeReadFacets(toolName) {
|
|
3277
|
+
switch (toolName) {
|
|
3278
|
+
case "excel.range.read_values":
|
|
3279
|
+
return ["values"];
|
|
3280
|
+
case "excel.range.read_formulas":
|
|
3281
|
+
return ["formulas"];
|
|
3282
|
+
case "excel.range.read_number_formats":
|
|
3283
|
+
return ["numberFormat"];
|
|
3284
|
+
case "excel.range.read_display_text":
|
|
3285
|
+
return ["text"];
|
|
3286
|
+
case "excel.range.read_styles":
|
|
3287
|
+
return ["style"];
|
|
3288
|
+
default:
|
|
3289
|
+
return ["values", "formulas", "numberFormat", "text", "style"];
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
async function readRangeSnapshot(workbookId, sheetName, address, facets) {
|
|
3256
3293
|
const operation = {
|
|
3257
3294
|
kind: "range.read_full",
|
|
3258
3295
|
operationId: makeId("op"),
|
|
@@ -3265,6 +3302,9 @@ async function readRangeSnapshot(workbookId, sheetName, address) {
|
|
|
3265
3302
|
address
|
|
3266
3303
|
}
|
|
3267
3304
|
};
|
|
3305
|
+
if (facets !== undefined) {
|
|
3306
|
+
operation.facets = facets;
|
|
3307
|
+
}
|
|
3268
3308
|
return runtime.applyBatch({
|
|
3269
3309
|
workbookId: workbookId,
|
|
3270
3310
|
mode: "apply",
|
|
@@ -3291,6 +3331,31 @@ function tableSelector(args) {
|
|
|
3291
3331
|
tableName: args.tableName
|
|
3292
3332
|
};
|
|
3293
3333
|
}
|
|
3334
|
+
function tableReadRequest(args) {
|
|
3335
|
+
const request = tableSelector(args);
|
|
3336
|
+
if (args.includeValues !== undefined) {
|
|
3337
|
+
request.includeValues = args.includeValues;
|
|
3338
|
+
}
|
|
3339
|
+
if (args.includeFormulas !== undefined) {
|
|
3340
|
+
request.includeFormulas = args.includeFormulas;
|
|
3341
|
+
}
|
|
3342
|
+
if (args.includeText !== undefined) {
|
|
3343
|
+
request.includeText = args.includeText;
|
|
3344
|
+
}
|
|
3345
|
+
if (args.includeNumberFormats !== undefined) {
|
|
3346
|
+
request.includeNumberFormats = args.includeNumberFormats;
|
|
3347
|
+
}
|
|
3348
|
+
if (args.columns !== undefined) {
|
|
3349
|
+
request.columns = args.columns;
|
|
3350
|
+
}
|
|
3351
|
+
if (args.rowOffset !== undefined) {
|
|
3352
|
+
request.rowOffset = args.rowOffset;
|
|
3353
|
+
}
|
|
3354
|
+
if (args.rowLimit !== undefined) {
|
|
3355
|
+
request.rowLimit = args.rowLimit;
|
|
3356
|
+
}
|
|
3357
|
+
return request;
|
|
3358
|
+
}
|
|
3294
3359
|
function tableCreateRequest(args) {
|
|
3295
3360
|
const request = {
|
|
3296
3361
|
workbookId: args.workbookId,
|