apple-numbers-mcp 0.5.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/LICENSE +21 -0
- package/README.md +709 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +483 -0
- package/build/index.js.map +1 -0
- package/build/services/fileConfig.d.ts +7 -0
- package/build/services/fileConfig.d.ts.map +1 -0
- package/build/services/fileConfig.js +52 -0
- package/build/services/fileConfig.js.map +1 -0
- package/build/services/numbersManager.d.ts +175 -0
- package/build/services/numbersManager.d.ts.map +1 -0
- package/build/services/numbersManager.js +357 -0
- package/build/services/numbersManager.js.map +1 -0
- package/build/tools/doctor.d.ts +22 -0
- package/build/tools/doctor.d.ts.map +1 -0
- package/build/tools/doctor.js +96 -0
- package/build/tools/doctor.js.map +1 -0
- package/build/tools/resourcesAndPrompts.d.ts +15 -0
- package/build/tools/resourcesAndPrompts.d.ts.map +1 -0
- package/build/tools/resourcesAndPrompts.js +77 -0
- package/build/tools/resourcesAndPrompts.js.map +1 -0
- package/build/tools/respond.d.ts +29 -0
- package/build/tools/respond.d.ts.map +1 -0
- package/build/tools/respond.js +44 -0
- package/build/tools/respond.js.map +1 -0
- package/build/types.d.ts +128 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/build/utils/applescript.d.ts +90 -0
- package/build/utils/applescript.d.ts.map +1 -0
- package/build/utils/applescript.js +248 -0
- package/build/utils/applescript.js.map +1 -0
- package/build/utils/python.d.ts +12 -0
- package/build/utils/python.d.ts.map +1 -0
- package/build/utils/python.js +101 -0
- package/build/utils/python.js.map +1 -0
- package/package.json +91 -0
- package/requirements.txt +1 -0
- package/scripts/setup.sh +46 -0
- package/src/utils/numbers_reader.py +779 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setup "doctor": one diagnostic covering the things that actually break an
|
|
3
|
+
* apple-numbers-mcp setup — the numbers-parser Python sidecar (used for reads),
|
|
4
|
+
* the presence of Numbers.app (required for AppleScript write/format tools), and
|
|
5
|
+
* the Automation permission those write tools need — each reported as
|
|
6
|
+
* ok / warn / fail with an actionable message.
|
|
7
|
+
*
|
|
8
|
+
* @module tools/doctor
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync } from "node:fs";
|
|
11
|
+
import { checkDependencies } from "../utils/python.js";
|
|
12
|
+
/** Candidate install locations for Numbers.app. */
|
|
13
|
+
const NUMBERS_APP_PATHS = ["/Applications/Numbers.app", "/System/Applications/Numbers.app"];
|
|
14
|
+
/**
|
|
15
|
+
* Run all diagnostic checks. This function NEVER throws — every probe is wrapped
|
|
16
|
+
* in try/catch and converted to a fail/warn/ok check.
|
|
17
|
+
*
|
|
18
|
+
* The `manager` parameter is accepted for symmetry with the other tools and to
|
|
19
|
+
* leave room for future manager-backed probes; the current checks don't need it.
|
|
20
|
+
*/
|
|
21
|
+
export function runDoctor(_manager) {
|
|
22
|
+
const checks = [];
|
|
23
|
+
// 1. numbers-parser (Python sidecar) — powers all read/export operations.
|
|
24
|
+
try {
|
|
25
|
+
const dep = checkDependencies();
|
|
26
|
+
checks.push({
|
|
27
|
+
name: "numbers_parser",
|
|
28
|
+
status: dep.ok ? "ok" : "fail",
|
|
29
|
+
detail: dep.ok ? dep.message : `${dep.message} Run: npm run setup`,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
checks.push({
|
|
34
|
+
name: "numbers_parser",
|
|
35
|
+
status: "fail",
|
|
36
|
+
detail: `could not verify numbers-parser: ${String(e)}. Run: npm run setup`,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
// 2. Numbers.app — required for AppleScript write/format tools. Reads via
|
|
40
|
+
// numbers-parser still work without it, so its absence is a warn, not a fail.
|
|
41
|
+
try {
|
|
42
|
+
const found = NUMBERS_APP_PATHS.find((p) => existsSync(p));
|
|
43
|
+
if (found) {
|
|
44
|
+
checks.push({
|
|
45
|
+
name: "numbers_app",
|
|
46
|
+
status: "ok",
|
|
47
|
+
detail: `Numbers.app present — write operations available (${found})`,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
checks.push({
|
|
52
|
+
name: "numbers_app",
|
|
53
|
+
status: "warn",
|
|
54
|
+
detail: "Numbers.app not found. Reads/exports via numbers-parser still work, but " +
|
|
55
|
+
"write, formatting, and other AppleScript tools need Numbers.app installed.",
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
checks.push({
|
|
61
|
+
name: "numbers_app",
|
|
62
|
+
status: "warn",
|
|
63
|
+
detail: `could not verify Numbers.app: ${String(e)}. Reads/exports still work; ` +
|
|
64
|
+
"write/formatting tools need Numbers.app.",
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
// 3. Automation permission — can't be probed without side effects, so this is
|
|
68
|
+
// informational. AppleScript write tools require Automation permission for
|
|
69
|
+
// Numbers.app, granted on first use.
|
|
70
|
+
try {
|
|
71
|
+
checks.push({
|
|
72
|
+
name: "automation_permission",
|
|
73
|
+
status: "ok",
|
|
74
|
+
detail: "AppleScript write tools require Automation permission for Numbers.app, " +
|
|
75
|
+
"granted on first use (System Settings > Privacy & Security > Automation).",
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
catch (e) {
|
|
79
|
+
checks.push({
|
|
80
|
+
name: "automation_permission",
|
|
81
|
+
status: "ok",
|
|
82
|
+
detail: `informational: ${String(e)}`,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const healthy = !checks.some((c) => c.status === "fail");
|
|
86
|
+
return { healthy, checks };
|
|
87
|
+
}
|
|
88
|
+
/** Render a DoctorReport as readable text. */
|
|
89
|
+
export function formatDoctorReport(r) {
|
|
90
|
+
const icon = (s) => (s === "ok" ? "✅" : s === "warn" ? "⚠️ " : "❌");
|
|
91
|
+
const lines = [`🩺 apple-numbers-mcp doctor — ${r.healthy ? "healthy" : "ISSUES FOUND"}`, ""];
|
|
92
|
+
for (const c of r.checks)
|
|
93
|
+
lines.push(`${icon(c.status)} ${c.name}: ${c.detail}`);
|
|
94
|
+
return lines.join("\n");
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/tools/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAavD,mDAAmD;AACnD,MAAM,iBAAiB,GAAG,CAAC,2BAA2B,EAAE,kCAAkC,CAAC,CAAC;AAE5F;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,QAAwB;IAChD,MAAM,MAAM,GAAkB,EAAE,CAAC;IAEjC,0EAA0E;IAC1E,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,iBAAiB,EAAE,CAAC;QAChC,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,gBAAgB;YACtB,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM;YAC9B,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,qBAAqB;SACnE,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,gBAAgB;YACtB,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,oCAAoC,MAAM,CAAC,CAAC,CAAC,sBAAsB;SAC5E,CAAC,CAAC;IACL,CAAC;IAED,0EAA0E;IAC1E,iFAAiF;IACjF,IAAI,CAAC;QACH,MAAM,KAAK,GAAG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CAAC;AAC7B,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,kBAAkB,CAAC,CAAe;IAChD,MAAM,IAAI,GAAG,CAAC,CAAc,EAAU,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACzF,MAAM,KAAK,GAAG,CAAC,iCAAiC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9F,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IACjF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP resources & prompts for apple-numbers.
|
|
3
|
+
*
|
|
4
|
+
* Unlike a single-library server, numbers tools operate on a file PATH, so
|
|
5
|
+
* resources are templated by an encoded path: an agent can attach the structure
|
|
6
|
+
* of any .numbers file (or its default table) as context without a tool
|
|
7
|
+
* round-trip. Prompts are reusable starting points for common spreadsheet
|
|
8
|
+
* workflows (analyzing, bulk-editing, importing CSV/TSV).
|
|
9
|
+
*
|
|
10
|
+
* @module tools/resourcesAndPrompts
|
|
11
|
+
*/
|
|
12
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
13
|
+
import type { NumbersManager } from "../services/numbersManager.js";
|
|
14
|
+
export declare function registerResourcesAndPrompts(server: McpServer, manager: NumbersManager): void;
|
|
15
|
+
//# sourceMappingURL=resourcesAndPrompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourcesAndPrompts.d.ts","sourceRoot":"","sources":["../../src/tools/resourcesAndPrompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,SAAS,EAAoB,MAAM,yCAAyC,CAAC;AAEtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAMpE,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CAmF5F"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP resources & prompts for apple-numbers.
|
|
3
|
+
*
|
|
4
|
+
* Unlike a single-library server, numbers tools operate on a file PATH, so
|
|
5
|
+
* resources are templated by an encoded path: an agent can attach the structure
|
|
6
|
+
* of any .numbers file (or its default table) as context without a tool
|
|
7
|
+
* round-trip. Prompts are reusable starting points for common spreadsheet
|
|
8
|
+
* workflows (analyzing, bulk-editing, importing CSV/TSV).
|
|
9
|
+
*
|
|
10
|
+
* @module tools/resourcesAndPrompts
|
|
11
|
+
*/
|
|
12
|
+
import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
const json = (uri, data) => ({
|
|
15
|
+
contents: [{ uri: uri.href, mimeType: "application/json", text: JSON.stringify(data, null, 2) }],
|
|
16
|
+
});
|
|
17
|
+
export function registerResourcesAndPrompts(server, manager) {
|
|
18
|
+
// --- Resources ---
|
|
19
|
+
// Templated by a URL-encoded .numbers file path. There's no global list of
|
|
20
|
+
// files to enumerate, so these are template-only ({ list: undefined }).
|
|
21
|
+
server.resource("file-info", new ResourceTemplate("numbers://file/{path}", { list: undefined }), (uri, variables) => {
|
|
22
|
+
try {
|
|
23
|
+
const path = decodeURIComponent(String(variables.path));
|
|
24
|
+
return json(uri, manager.getFileInfo(path));
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
return json(uri, { error: err instanceof Error ? err.message : String(err) });
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
server.resource("table", new ResourceTemplate("numbers://table/{path}", { list: undefined }), (uri, variables) => {
|
|
31
|
+
try {
|
|
32
|
+
const path = decodeURIComponent(String(variables.path));
|
|
33
|
+
return json(uri, manager.readTable(path));
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
return json(uri, { error: err instanceof Error ? err.message : String(err) });
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
// --- Prompts ---
|
|
40
|
+
server.prompt("analyze-spreadsheet", "Summarize the structure and key data of a .numbers spreadsheet", { path: z.string().describe("Path to the .numbers file to analyze") }, ({ path }) => ({
|
|
41
|
+
messages: [
|
|
42
|
+
{
|
|
43
|
+
role: "user",
|
|
44
|
+
content: {
|
|
45
|
+
type: "text",
|
|
46
|
+
text: `Analyze the Numbers spreadsheet at "${path}". First use get-file-info to discover its sheets, tables, dimensions, and headers. Then use read-table on the most relevant table(s) to inspect the data. Give me a concise summary of the spreadsheet's structure (sheets/tables and their sizes) and the key data it contains — what each table represents, notable columns, and any obvious totals or patterns.`,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
}));
|
|
51
|
+
server.prompt("bulk-edit", "Read a spreadsheet's table(s) and apply a batch of edits", {
|
|
52
|
+
path: z.string().describe("Path to the .numbers file to edit"),
|
|
53
|
+
instructions: z.string().describe("What changes to make (which cells/rows and new values)"),
|
|
54
|
+
}, ({ path, instructions }) => ({
|
|
55
|
+
messages: [
|
|
56
|
+
{
|
|
57
|
+
role: "user",
|
|
58
|
+
content: {
|
|
59
|
+
type: "text",
|
|
60
|
+
text: `Apply the following edits to the Numbers spreadsheet at "${path}":\n\n${instructions}\n\nFirst use get-file-info and read-table to read the relevant table(s) so you know the current layout and 0-based row/column indices. Then apply the changes using the most efficient tool: set-cells-batch for scattered cell updates, add-rows to append new rows, or update-rows to overwrite full rows by index. After editing, re-read the affected cells and confirm what changed.`,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
}));
|
|
65
|
+
server.prompt("import-csv-guide", "Explain how to convert a CSV/TSV file into a .numbers file", () => ({
|
|
66
|
+
messages: [
|
|
67
|
+
{
|
|
68
|
+
role: "user",
|
|
69
|
+
content: {
|
|
70
|
+
type: "text",
|
|
71
|
+
text: "Explain how to use the import-csv tool to convert a CSV or TSV file into a new .numbers spreadsheet. Cover: passing inputPath (the source CSV/TSV/JSON) and outputPath (the new .numbers file); that format defaults to auto-detect from the file extension but can be set explicitly to csv/tsv/json; and the optional sheetName/tableName overrides. Note that the first row is treated as headers and that import creates a brand-new file rather than modifying an existing one.",
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=resourcesAndPrompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourcesAndPrompts.js","sourceRoot":"","sources":["../../src/tools/resourcesAndPrompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAa,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,IAAI,GAAG,CAAC,GAAQ,EAAE,IAAa,EAAE,EAAE,CAAC,CAAC;IACzC,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,kBAAkB,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;CACjG,CAAC,CAAC;AAEH,MAAM,UAAU,2BAA2B,CAAC,MAAiB,EAAE,OAAuB;IACpF,oBAAoB;IACpB,2EAA2E;IAC3E,wEAAwE;IACxE,MAAM,CAAC,QAAQ,CACb,WAAW,EACX,IAAI,g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EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC,EAAE,EACrE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QACb,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,uCAAuC,IAAI,qWAAqW;iBACvZ;aACF;SACF;KACF,CAAC,CACH,CAAC;IAEF,MAAM,CAAC,MAAM,CACX,WAAW,EACX,0DAA0D,EAC1D;QACE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;QAC9D,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wDAAwD,CAAC;KAC5F,EACD,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;QAC3B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,4DAA4D,IAAI,SAAS,YAAY,4XAA4X;iBACxd;aACF;SACF;KACF,CAAC,CACH,CAAC;IAEF,MAAM,CAAC,MAAM,CACX,kBAAkB,EAClB,4DAA4D,EAC5D,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,sdAAsd;iBAC7d;aACF;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared MCP tool-response helpers.
|
|
3
|
+
*
|
|
4
|
+
* Every tool returns a human-readable `text` block AND, where it has structured
|
|
5
|
+
* data, a machine-readable `structuredContent` payload — so agents can consume
|
|
6
|
+
* results without parsing prose. Mirrors apple-notes-mcp / apple-mail-mcp.
|
|
7
|
+
*/
|
|
8
|
+
export interface ToolResponse {
|
|
9
|
+
content: {
|
|
10
|
+
type: "text";
|
|
11
|
+
text: string;
|
|
12
|
+
[k: string]: unknown;
|
|
13
|
+
}[];
|
|
14
|
+
structuredContent?: Record<string, unknown>;
|
|
15
|
+
isError?: boolean;
|
|
16
|
+
[k: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** A successful result: human text plus optional typed JSON for agents. */
|
|
19
|
+
export declare function successResponse(message: string, structured?: Record<string, unknown>): ToolResponse;
|
|
20
|
+
/** An error result. Optional structured payload carries machine-readable detail. */
|
|
21
|
+
export declare function errorResponse(message: string, structured?: Record<string, unknown>): ToolResponse;
|
|
22
|
+
/** Plain text result with no structured payload (kept for back-compat). */
|
|
23
|
+
export declare function textResponse(text: string): ToolResponse;
|
|
24
|
+
/**
|
|
25
|
+
* Wrap a tool handler so any thrown error becomes a clean error response with a
|
|
26
|
+
* consistent prefix, instead of crashing the tool call.
|
|
27
|
+
*/
|
|
28
|
+
export declare function withErrorHandling<T>(handler: (params: T) => ToolResponse, prefix: string): (params: T) => ToolResponse;
|
|
29
|
+
//# sourceMappingURL=respond.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"respond.d.ts","sourceRoot":"","sources":["../../src/tools/respond.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,EAAE,CAAC;IAChE,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,YAAY,CAId;AAED,oFAAoF;AACpF,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAOjG;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAEvD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,YAAY,EACpC,MAAM,EAAE,MAAM,GACb,CAAC,MAAM,EAAE,CAAC,KAAK,YAAY,CAS7B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared MCP tool-response helpers.
|
|
3
|
+
*
|
|
4
|
+
* Every tool returns a human-readable `text` block AND, where it has structured
|
|
5
|
+
* data, a machine-readable `structuredContent` payload — so agents can consume
|
|
6
|
+
* results without parsing prose. Mirrors apple-notes-mcp / apple-mail-mcp.
|
|
7
|
+
*/
|
|
8
|
+
/** A successful result: human text plus optional typed JSON for agents. */
|
|
9
|
+
export function successResponse(message, structured) {
|
|
10
|
+
const res = { content: [{ type: "text", text: message }] };
|
|
11
|
+
if (structured !== undefined)
|
|
12
|
+
res.structuredContent = structured;
|
|
13
|
+
return res;
|
|
14
|
+
}
|
|
15
|
+
/** An error result. Optional structured payload carries machine-readable detail. */
|
|
16
|
+
export function errorResponse(message, structured) {
|
|
17
|
+
const res = {
|
|
18
|
+
content: [{ type: "text", text: message }],
|
|
19
|
+
isError: true,
|
|
20
|
+
};
|
|
21
|
+
if (structured !== undefined)
|
|
22
|
+
res.structuredContent = structured;
|
|
23
|
+
return res;
|
|
24
|
+
}
|
|
25
|
+
/** Plain text result with no structured payload (kept for back-compat). */
|
|
26
|
+
export function textResponse(text) {
|
|
27
|
+
return { content: [{ type: "text", text }] };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Wrap a tool handler so any thrown error becomes a clean error response with a
|
|
31
|
+
* consistent prefix, instead of crashing the tool call.
|
|
32
|
+
*/
|
|
33
|
+
export function withErrorHandling(handler, prefix) {
|
|
34
|
+
return (params) => {
|
|
35
|
+
try {
|
|
36
|
+
return handler(params);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
40
|
+
return errorResponse(`${prefix}: ${msg}`);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=respond.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"respond.js","sourceRoot":"","sources":["../../src/tools/respond.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,2EAA2E;AAC3E,MAAM,UAAU,eAAe,CAC7B,OAAe,EACf,UAAoC;IAEpC,MAAM,GAAG,GAAiB,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACzE,IAAI,UAAU,KAAK,SAAS;QAAE,GAAG,CAAC,iBAAiB,GAAG,UAAU,CAAC;IACjE,OAAO,GAAG,CAAC;AACb,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,UAAoC;IACjF,MAAM,GAAG,GAAiB;QACxB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAC1C,OAAO,EAAE,IAAI;KACd,CAAC;IACF,IAAI,UAAU,KAAK,SAAS;QAAE,GAAG,CAAC,iBAAiB,GAAG,UAAU,CAAC;IACjE,OAAO,GAAG,CAAC;AACb,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAoC,EACpC,MAAc;IAEd,OAAO,CAAC,MAAS,EAAE,EAAE;QACnB,IAAI,CAAC;YACH,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnE,OAAO,aAAa,CAAC,GAAG,MAAM,KAAK,GAAG,EAAE,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
package/build/types.d.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
export interface NumbersFileInfo {
|
|
2
|
+
path: string;
|
|
3
|
+
sheets: SheetInfo[];
|
|
4
|
+
defaultSheet: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SheetInfo {
|
|
7
|
+
name: string;
|
|
8
|
+
tables: TableInfo[];
|
|
9
|
+
}
|
|
10
|
+
export interface TableInfo {
|
|
11
|
+
name: string;
|
|
12
|
+
sheetName: string;
|
|
13
|
+
numRows: number;
|
|
14
|
+
numCols: number;
|
|
15
|
+
headerRow: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface CellValue {
|
|
18
|
+
row: number;
|
|
19
|
+
col: number;
|
|
20
|
+
value: string | number | boolean | null;
|
|
21
|
+
type: "string" | "number" | "boolean" | "date" | "duration" | "empty" | "error";
|
|
22
|
+
formattedValue?: string;
|
|
23
|
+
formula?: string | null;
|
|
24
|
+
isFormula?: boolean;
|
|
25
|
+
isMerged?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface TableData {
|
|
28
|
+
sheetName: string;
|
|
29
|
+
tableName: string;
|
|
30
|
+
headers: string[];
|
|
31
|
+
rows: (string | number | boolean | null)[][];
|
|
32
|
+
numRows: number;
|
|
33
|
+
numCols: number;
|
|
34
|
+
}
|
|
35
|
+
export interface SearchResult {
|
|
36
|
+
sheetName: string;
|
|
37
|
+
tableName: string;
|
|
38
|
+
row: number;
|
|
39
|
+
col: number;
|
|
40
|
+
header: string;
|
|
41
|
+
value: string | number | boolean | null;
|
|
42
|
+
}
|
|
43
|
+
export interface ExportOptions {
|
|
44
|
+
format: "csv" | "json" | "tsv";
|
|
45
|
+
sheet?: string;
|
|
46
|
+
table?: string;
|
|
47
|
+
outputPath?: string;
|
|
48
|
+
includeHeaders?: boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface ExportResult {
|
|
51
|
+
outputPath: string;
|
|
52
|
+
format: string;
|
|
53
|
+
rowCount: number;
|
|
54
|
+
sheetName: string;
|
|
55
|
+
tableName: string;
|
|
56
|
+
}
|
|
57
|
+
export interface CreateResult {
|
|
58
|
+
path: string;
|
|
59
|
+
sheetName: string;
|
|
60
|
+
tableName: string;
|
|
61
|
+
numHeaders: number;
|
|
62
|
+
numRows: number;
|
|
63
|
+
}
|
|
64
|
+
export interface SetCellResult {
|
|
65
|
+
path: string;
|
|
66
|
+
sheetName: string;
|
|
67
|
+
tableName: string;
|
|
68
|
+
row: number;
|
|
69
|
+
col: number;
|
|
70
|
+
value: string;
|
|
71
|
+
}
|
|
72
|
+
export interface SetCellsBatchResult {
|
|
73
|
+
path: string;
|
|
74
|
+
sheetName: string;
|
|
75
|
+
tableName: string;
|
|
76
|
+
cellsWritten: number;
|
|
77
|
+
}
|
|
78
|
+
export interface AddRowsResult {
|
|
79
|
+
path: string;
|
|
80
|
+
sheetName: string;
|
|
81
|
+
tableName: string;
|
|
82
|
+
rowsAdded: number;
|
|
83
|
+
startRow: number;
|
|
84
|
+
newTotalRows: number;
|
|
85
|
+
}
|
|
86
|
+
export interface DeleteRowsResult {
|
|
87
|
+
path: string;
|
|
88
|
+
sheetName: string;
|
|
89
|
+
tableName: string;
|
|
90
|
+
rowsDeleted: number;
|
|
91
|
+
newTotalRows: number;
|
|
92
|
+
}
|
|
93
|
+
export interface AddSheetResult {
|
|
94
|
+
path: string;
|
|
95
|
+
sheetName: string;
|
|
96
|
+
tableName: string;
|
|
97
|
+
numRows: number;
|
|
98
|
+
numCols: number;
|
|
99
|
+
}
|
|
100
|
+
export interface AddTableResult {
|
|
101
|
+
path: string;
|
|
102
|
+
sheetName: string;
|
|
103
|
+
tableName: string;
|
|
104
|
+
numRows: number;
|
|
105
|
+
numCols: number;
|
|
106
|
+
}
|
|
107
|
+
export interface ImportResult {
|
|
108
|
+
path: string;
|
|
109
|
+
inputPath: string;
|
|
110
|
+
format: string;
|
|
111
|
+
sheetName: string;
|
|
112
|
+
tableName: string;
|
|
113
|
+
numHeaders: number;
|
|
114
|
+
numRows: number;
|
|
115
|
+
}
|
|
116
|
+
export interface UpdateRowsResult {
|
|
117
|
+
path: string;
|
|
118
|
+
sheetName: string;
|
|
119
|
+
tableName: string;
|
|
120
|
+
rowsUpdated: number;
|
|
121
|
+
}
|
|
122
|
+
export interface RenameResult {
|
|
123
|
+
path: string;
|
|
124
|
+
oldName: string;
|
|
125
|
+
newName: string;
|
|
126
|
+
sheetName?: string;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,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CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
package/build/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert 0-based row/col indices to A1 notation (e.g., 0,0 → "A1", 2,3 → "D3").
|
|
3
|
+
*/
|
|
4
|
+
export declare function toA1(row: number, col: number): string;
|
|
5
|
+
/**
|
|
6
|
+
* Run an AppleScript string via osascript and return stdout.
|
|
7
|
+
*/
|
|
8
|
+
export declare function runAppleScript(script: string, timeoutMs?: number): string;
|
|
9
|
+
export interface SetFormulaResult {
|
|
10
|
+
path: string;
|
|
11
|
+
sheetName: string;
|
|
12
|
+
tableName: string;
|
|
13
|
+
cell: string;
|
|
14
|
+
formula: string;
|
|
15
|
+
computedValue: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function setFormula(filePath: string, sheet: string, table: string, row: number, col: number, formula: string): SetFormulaResult;
|
|
18
|
+
export interface SetFormulasBatchResult {
|
|
19
|
+
path: string;
|
|
20
|
+
sheetName: string;
|
|
21
|
+
tableName: string;
|
|
22
|
+
cellsSet: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function setFormulasBatch(filePath: string, sheet: string, table: string, formulas: {
|
|
25
|
+
row: number;
|
|
26
|
+
col: number;
|
|
27
|
+
formula: string;
|
|
28
|
+
}[]): SetFormulasBatchResult;
|
|
29
|
+
/** RGB color as 0-65535 per channel (AppleScript's native format). */
|
|
30
|
+
export interface ASColor {
|
|
31
|
+
red: number;
|
|
32
|
+
green: number;
|
|
33
|
+
blue: number;
|
|
34
|
+
}
|
|
35
|
+
export interface CellStyle {
|
|
36
|
+
fontName?: string;
|
|
37
|
+
fontSize?: number;
|
|
38
|
+
textColor?: ASColor;
|
|
39
|
+
backgroundColor?: ASColor;
|
|
40
|
+
format?: "automatic" | "number" | "currency" | "date and time" | "duration" | "fraction" | "scientific" | "numeral system" | "checkbox" | "star rating" | "text";
|
|
41
|
+
alignment?: "auto align" | "left" | "center" | "right" | "justify";
|
|
42
|
+
verticalAlignment?: "top" | "center" | "bottom";
|
|
43
|
+
textWrap?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface CellStyleResult {
|
|
46
|
+
path: string;
|
|
47
|
+
sheetName: string;
|
|
48
|
+
tableName: string;
|
|
49
|
+
cell: string;
|
|
50
|
+
}
|
|
51
|
+
export declare function setCellStyle(filePath: string, sheet: string, table: string, row: number, col: number, style: CellStyle): CellStyleResult;
|
|
52
|
+
export interface BatchStyleEntry {
|
|
53
|
+
row: number;
|
|
54
|
+
col: number;
|
|
55
|
+
style: CellStyle;
|
|
56
|
+
}
|
|
57
|
+
export interface SetCellsStyleBatchResult {
|
|
58
|
+
path: string;
|
|
59
|
+
sheetName: string;
|
|
60
|
+
tableName: string;
|
|
61
|
+
cellsStyled: number;
|
|
62
|
+
}
|
|
63
|
+
export declare function setCellsStyleBatch(filePath: string, sheet: string, table: string, entries: BatchStyleEntry[]): SetCellsStyleBatchResult;
|
|
64
|
+
export interface SetDimensionResult {
|
|
65
|
+
path: string;
|
|
66
|
+
sheetName: string;
|
|
67
|
+
tableName: string;
|
|
68
|
+
}
|
|
69
|
+
export declare function setColumnWidth(filePath: string, sheet: string, table: string, col: number, width: number): SetDimensionResult;
|
|
70
|
+
export declare function setRowHeight(filePath: string, sheet: string, table: string, row: number, height: number): SetDimensionResult;
|
|
71
|
+
export interface MergeResult {
|
|
72
|
+
path: string;
|
|
73
|
+
sheetName: string;
|
|
74
|
+
tableName: string;
|
|
75
|
+
range: string;
|
|
76
|
+
}
|
|
77
|
+
export declare function mergeCells(filePath: string, sheet: string, table: string, startRow: number, startCol: number, endRow: number, endCol: number): MergeResult;
|
|
78
|
+
export declare function unmergeCells(filePath: string, sheet: string, table: string, startRow: number, startCol: number, endRow: number, endCol: number): MergeResult;
|
|
79
|
+
export interface ReadCellStyleResult {
|
|
80
|
+
fontName: string;
|
|
81
|
+
fontSize: number;
|
|
82
|
+
textColor: ASColor;
|
|
83
|
+
backgroundColor: ASColor;
|
|
84
|
+
format: string;
|
|
85
|
+
alignment: string;
|
|
86
|
+
verticalAlignment: string;
|
|
87
|
+
textWrap: boolean;
|
|
88
|
+
}
|
|
89
|
+
export declare function getCellStyle(filePath: string, sheet: string, table: string, row: number, col: number): ReadCellStyleResult;
|
|
90
|
+
//# sourceMappingURL=applescript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applescript.d.ts","sourceRoot":"","sources":["../../src/utils/applescript.ts"],"names":[],"mappings":"AAwCA;;GAEG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,G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