rubien-mcp-server 0.2.0 → 0.3.1
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 +33 -13
- package/dist/cli.js +60 -31
- package/dist/cli.js.map +1 -1
- package/dist/index.js +26 -13
- package/dist/index.js.map +1 -1
- package/dist/schemas.js +42 -19
- package/dist/schemas.js.map +1 -1
- package/dist/server.js +23 -1
- package/dist/server.js.map +1 -1
- package/dist/toolHelpers.js +24 -4
- package/dist/toolHelpers.js.map +1 -1
- package/dist/tools/citations.js +3 -3
- package/dist/tools/io.js +3 -31
- package/dist/tools/io.js.map +1 -1
- package/dist/tools/pdf.js +7 -10
- package/dist/tools/pdf.js.map +1 -1
- package/dist/tools/properties.js +75 -144
- package/dist/tools/properties.js.map +1 -1
- package/dist/tools/read.js +2 -2
- package/dist/tools/read.js.map +1 -1
- package/dist/tools/references.js +114 -41
- package/dist/tools/references.js.map +1 -1
- package/dist/tools/sync.js +1 -1
- package/dist/tools/sync.js.map +1 -1
- package/dist/tools/views.js +17 -34
- package/dist/tools/views.js.map +1 -1
- package/dist/versionGuard.js +87 -23
- package/dist/versionGuard.js.map +1 -1
- package/package.json +15 -4
package/dist/tools/io.js
CHANGED
|
@@ -1,36 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { runCliAsTool } from "../toolHelpers.js";
|
|
3
|
+
// `rubien_import` was folded into `rubien_create_reference` (references.ts) in
|
|
4
|
+
// the 0.3.0 catalog — one door for every input; the CLI routes the locator.
|
|
3
5
|
export function registerIOTools(server) {
|
|
4
|
-
server.registerTool("rubien_import", {
|
|
5
|
-
title: "Import a PDF, BibTeX/RIS, Markdown, or folder",
|
|
6
|
-
description: "Import references from a local file (PDF .pdf / BibTeX .bib / RIS .ris / Markdown .md — Obsidian Web Clipper frontmatter is mapped, plain notes import too), a direct HTTP(S) PDF/Markdown file URL with a supported path extension, or a folder (Zotero export, or a folder of .md files). Folder imports stamp a single-/multi-select property value on every imported reference via property + value (default: Tags = folder basename). A folder containing both .bib and .md needs format to disambiguate.",
|
|
7
|
-
inputSchema: {
|
|
8
|
-
file: z
|
|
9
|
-
.string()
|
|
10
|
-
.describe("Absolute path on the host, or a direct HTTP(S) URL with a .pdf, .md, or .markdown path extension. Stdin piping ('-') is not supported through the MCP wrapper; if you need it, invoke rubien-cli directly."),
|
|
11
|
-
format: z
|
|
12
|
-
.enum(["bib", "ris", "md"])
|
|
13
|
-
.optional()
|
|
14
|
-
.describe("For folders, disambiguates when both .bib and .md are present. Direct HTTP(S) URLs must have a .pdf, .md, or .markdown path extension."),
|
|
15
|
-
property: z
|
|
16
|
-
.string()
|
|
17
|
-
.optional()
|
|
18
|
-
.describe("(Folder imports) Property name to stamp on imported refs"),
|
|
19
|
-
value: z
|
|
20
|
-
.string()
|
|
21
|
-
.optional()
|
|
22
|
-
.describe("(Folder imports) Value for --property on imported refs"),
|
|
23
|
-
},
|
|
24
|
-
annotations: { destructiveHint: true },
|
|
25
|
-
}, async ({ file, format, property, value }) => runCliAsTool([
|
|
26
|
-
"import",
|
|
27
|
-
file,
|
|
28
|
-
...flagsFromOptions({
|
|
29
|
-
"--format": format,
|
|
30
|
-
"--property": property,
|
|
31
|
-
"--value": value,
|
|
32
|
-
}),
|
|
33
|
-
], { timeoutMs: 180_000 }));
|
|
34
6
|
server.registerTool("rubien_export", {
|
|
35
7
|
title: "Export references",
|
|
36
8
|
description: "Export the library (or a subset) as JSON, BibTeX, or RIS. BibTeX/RIS output is plain text; JSON is a ReferenceDTO[] array.",
|
package/dist/tools/io.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"io.js","sourceRoot":"","sources":["../../src/tools/io.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"io.js","sourceRoot":"","sources":["../../src/tools/io.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,+EAA+E;AAC/E,4EAA4E;AAE5E,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,MAAM,CAAC,YAAY,CACjB,eAAe,EACf;QACE,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EACT,4HAA4H;QAC9H,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE;iBACjD,QAAQ,CAAC,iBAAiB,CAAC;SAC/B;QACD,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;KACpC,EACD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QACnB,MAAM,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxB,IAAI,MAAM;YAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAC1C,MAAM,QAAQ,GAAG,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,KAAK,CAAC;QACzD,OAAO,YAAY,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC1C,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/pdf.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { CliError, invokeCliTyped } from "../cli.js";
|
|
3
|
-
import { flagsFromOptions, runCliAsTool } from "../toolHelpers.js";
|
|
3
|
+
import { errorResult, flagsFromOptions, runCliAsTool } from "../toolHelpers.js";
|
|
4
4
|
export function registerPdfTools(server) {
|
|
5
|
-
server.registerTool("
|
|
5
|
+
server.registerTool("rubien_get_pdf_info", {
|
|
6
6
|
title: "Probe PDF metadata + outline",
|
|
7
7
|
description: "Return page count, hasTextLayer (sampled across first/middle/last page), file size, isEncrypted, documentTitle, and the flattened outline `sections` (or null when the PDF has no outline). Each section carries title, level (1=top), startPage, and endPage; parent ranges span their descendants. Call this before `rubien_read_text` when you plan to select by `sections` or page ranges.",
|
|
8
8
|
inputSchema: {
|
|
@@ -10,7 +10,7 @@ export function registerPdfTools(server) {
|
|
|
10
10
|
},
|
|
11
11
|
annotations: { readOnlyHint: true },
|
|
12
12
|
}, async ({ id }) => runCliAsTool(["pdf", "info", String(id)]));
|
|
13
|
-
server.registerTool("
|
|
13
|
+
server.registerTool("rubien_render_pdf_page", {
|
|
14
14
|
title: "Render a PDF page as an image",
|
|
15
15
|
description: "Render a single PDF page (1-indexed) and return it as an MCP image content block. Use this when text extraction is empty/garbled (scanned page, dense math) or when a figure/table is referenced in the surrounding text. Defaults: JPEG at scale=2.0 (~192 DPI) with quality stepdown to honor maxBytes. PNG mode is opt-in for lossless output but hard-fails on maxBytes.",
|
|
16
16
|
inputSchema: {
|
|
@@ -70,17 +70,14 @@ export function registerPdfTools(server) {
|
|
|
70
70
|
}
|
|
71
71
|
catch (err) {
|
|
72
72
|
if (err instanceof CliError) {
|
|
73
|
-
return
|
|
74
|
-
content: [{ type: "text", text: err.message }],
|
|
75
|
-
isError: true,
|
|
76
|
-
};
|
|
73
|
+
return errorResult(err.message);
|
|
77
74
|
}
|
|
78
75
|
throw err;
|
|
79
76
|
}
|
|
80
77
|
});
|
|
81
|
-
server.registerTool("
|
|
82
|
-
title: "Download the open-access PDF for
|
|
83
|
-
description: "Fetch the open-access PDF (via DOI or arXiv resolution) and attach it to
|
|
78
|
+
server.registerTool("rubien_download_pdf", {
|
|
79
|
+
title: "Download the open-access PDF for an existing reference",
|
|
80
|
+
description: "Fetch the open-access PDF (via DOI or arXiv resolution) and attach it to an EXISTING reference (creation via rubien_create_reference fetches PDFs itself with `downloadPdf`). Skip-if-attached by default; pass `force: true` to detach the existing PDF and re-download. Side effects: writes a file under the library's PDF storage and inserts a pdfCache row + pdfUploadQueue row (so the running app's sync engine will push to CloudKit). Returns `{ id, ok, action, filename? }` where `action` is `\"downloaded\" | \"replaced\" | \"already-attached\" | \"already-pending\"`. Errors (isError) when the reference is missing, has no DOI/arXiv, or the network fetch fails. Long-running — up to 5 minutes.",
|
|
84
81
|
inputSchema: {
|
|
85
82
|
id: z.number().int().describe("Reference ID"),
|
|
86
83
|
force: z
|
package/dist/tools/pdf.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pdf.js","sourceRoot":"","sources":["../../src/tools/pdf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"pdf.js","sourceRoot":"","sources":["../../src/tools/pdf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAYhF,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,MAAM,CAAC,YAAY,CACjB,qBAAqB,EACrB;QACE,KAAK,EAAE,8BAA8B;QACrC,WAAW,EACT,gYAAgY;QAClY,WAAW,EAAE;YACX,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;SAC9C;QACD,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;KACpC,EACD,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,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AE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7C,IAAI,KAAK;YAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAChC,OAAO,YAAY,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;IACpD,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/properties.js
CHANGED
|
@@ -10,19 +10,22 @@ const PROPERTY_TYPES = [
|
|
|
10
10
|
"checkbox",
|
|
11
11
|
];
|
|
12
12
|
/// Tags are exposed as the seeded built-in PropertyDefinition with
|
|
13
|
-
/// `defaultFieldKey == "tags"`.
|
|
14
|
-
///
|
|
15
|
-
///
|
|
16
|
-
///
|
|
17
|
-
///
|
|
13
|
+
/// `defaultFieldKey == "tags"`. The option tools below treat Tags options as
|
|
14
|
+
/// Tag rows — `create_option` creates a new Tag from a name + color,
|
|
15
|
+
/// `update_option` / `delete_option` address tags by stringified tag ID.
|
|
16
|
+
/// ASSIGNING values to a reference is rubien_update_reference's `properties`
|
|
17
|
+
/// payload, not these tools.
|
|
18
18
|
function tagsContractNote(extra = "") {
|
|
19
|
-
return ("For the built-in Tags property (defaultFieldKey == 'tags'):
|
|
20
|
-
"
|
|
21
|
-
"(value=name, color=hex)." +
|
|
19
|
+
return ("For the built-in Tags property (defaultFieldKey == 'tags'): options are " +
|
|
20
|
+
"Tag rows addressed by stringified tag ID. Create new tags via " +
|
|
21
|
+
"rubien_create_option (value=name, color=hex)." +
|
|
22
22
|
(extra ? " " + extra : ""));
|
|
23
23
|
}
|
|
24
|
+
/// The column-vs-cell boundary, stated on every option tool: these tools
|
|
25
|
+
/// edit the CHOICES; update_reference edits a reference's chosen VALUES.
|
|
26
|
+
const assignmentPointer = " (These tools edit the available choices themselves. To assign/unassign values on a specific reference, use rubien_update_reference's `properties` payload.)";
|
|
24
27
|
export function registerPropertyTools(server) {
|
|
25
|
-
server.registerTool("
|
|
28
|
+
server.registerTool("rubien_list_properties", {
|
|
26
29
|
title: "List property definitions (incl. Tags)",
|
|
27
30
|
description: "List property definitions. Returns PropertyDefinitionDTO[] with options inlined: " +
|
|
28
31
|
"{value, label, color}. For the built-in Tags property each option is one Tag row " +
|
|
@@ -31,7 +34,7 @@ export function registerPropertyTools(server) {
|
|
|
31
34
|
"and override `visible`. Unresolved selectors fail loudly with an `unresolved-selectors` error envelope.",
|
|
32
35
|
inputSchema: {
|
|
33
36
|
ids: z
|
|
34
|
-
.array(z.
|
|
37
|
+
.array(z.number().int())
|
|
35
38
|
.optional()
|
|
36
39
|
.describe("Repeatable property IDs to include. Errors if any ID does not exist."),
|
|
37
40
|
names: z
|
|
@@ -49,22 +52,24 @@ export function registerPropertyTools(server) {
|
|
|
49
52
|
if (visible)
|
|
50
53
|
args.push("--visible");
|
|
51
54
|
for (const id of ids ?? [])
|
|
52
|
-
args.push("--id", id);
|
|
55
|
+
args.push("--id", String(id));
|
|
53
56
|
for (const n of names ?? [])
|
|
54
57
|
args.push("--name", n);
|
|
55
58
|
return runCliAsTool(args);
|
|
56
59
|
});
|
|
57
|
-
server.registerTool("
|
|
58
|
-
title: "Create custom property",
|
|
59
|
-
description: "Create a new custom property definition. To create a new tag instead, use
|
|
60
|
+
server.registerTool("rubien_create_property", {
|
|
61
|
+
title: "Create custom property (column)",
|
|
62
|
+
description: "Create a new custom property definition (a column). All-digit names are rejected — they would shadow id selectors in rubien_update_reference's payload. To create a new tag instead, use rubien_create_option against the built-in Tags property." +
|
|
63
|
+
assignmentPointer,
|
|
60
64
|
inputSchema: {
|
|
61
|
-
name: z.string(),
|
|
65
|
+
name: z.string().describe("Property name (must not be all digits)"),
|
|
62
66
|
type: z.enum(PROPERTY_TYPES),
|
|
63
67
|
options: z
|
|
64
68
|
.string()
|
|
65
69
|
.optional()
|
|
66
70
|
.describe("For singleSelect/multiSelect, comma-separated option labels."),
|
|
67
71
|
},
|
|
72
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
68
73
|
}, async ({ name, type, options }) => runCliAsTool([
|
|
69
74
|
"properties",
|
|
70
75
|
"--create",
|
|
@@ -74,73 +79,79 @@ export function registerPropertyTools(server) {
|
|
|
74
79
|
"--options": options,
|
|
75
80
|
}),
|
|
76
81
|
]));
|
|
77
|
-
server.registerTool("
|
|
82
|
+
server.registerTool("rubien_update_property", {
|
|
83
|
+
title: "Update property (rename and/or visibility)",
|
|
84
|
+
description: "Update a property definition: rename it and/or change its UI visibility, in one transaction. At least one of `name` / `visible` is required. Built-in properties (incl. Tags) cannot be renamed; visibility can be changed on any property. All-digit names are rejected.",
|
|
85
|
+
inputSchema: {
|
|
86
|
+
id: z.number().int().describe("Property ID"),
|
|
87
|
+
name: z.string().optional().describe("New display name"),
|
|
88
|
+
visible: z.boolean().optional().describe("Show (true) or hide (false) in the app UI"),
|
|
89
|
+
},
|
|
90
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
91
|
+
}, async ({ id, name, visible }) => {
|
|
92
|
+
const args = ["properties", "--update", "--id", String(id)];
|
|
93
|
+
if (name !== undefined)
|
|
94
|
+
args.push("--name", name);
|
|
95
|
+
if (visible !== undefined)
|
|
96
|
+
args.push("--set-visible", String(visible));
|
|
97
|
+
return runCliAsTool(args);
|
|
98
|
+
});
|
|
99
|
+
server.registerTool("rubien_delete_property", {
|
|
78
100
|
title: "Delete custom property",
|
|
79
|
-
description: "Remove a property definition and all its values on references. Cannot delete default/built-in properties (Tags included — use
|
|
80
|
-
inputSchema: { id: z.
|
|
81
|
-
annotations: { destructiveHint: true },
|
|
82
|
-
}, async ({ id }) => runCliAsTool(["properties", "--delete", id]));
|
|
83
|
-
server.registerTool("
|
|
84
|
-
title: "
|
|
85
|
-
description: "Change a property's display name. Built-in properties (incl. Tags) cannot be renamed.",
|
|
86
|
-
inputSchema: { id: z.string(), name: z.string() },
|
|
87
|
-
}, async ({ id, name }) => runCliAsTool(["properties", "--rename", "--id", id, "--name", name]));
|
|
88
|
-
server.registerTool("rubien_properties_show", {
|
|
89
|
-
title: "Show property in UI",
|
|
90
|
-
description: "Mark a property as visible in the app UI.",
|
|
91
|
-
inputSchema: { id: z.string() },
|
|
92
|
-
}, async ({ id }) => runCliAsTool(["properties", "--show", "--id", id]));
|
|
93
|
-
server.registerTool("rubien_properties_hide", {
|
|
94
|
-
title: "Hide property in UI",
|
|
95
|
-
description: "Mark a property as hidden in the app UI.",
|
|
96
|
-
inputSchema: { id: z.string() },
|
|
97
|
-
}, async ({ id }) => runCliAsTool(["properties", "--hide", "--id", id]));
|
|
98
|
-
server.registerTool("rubien_properties_add_option", {
|
|
99
|
-
title: "Add option to select property (creates a Tag for the Tags property)",
|
|
101
|
+
description: "Remove a property definition and all its values on references. Cannot delete default/built-in properties (Tags included — use rubien_delete_option to remove individual tags).",
|
|
102
|
+
inputSchema: { id: z.number().int() },
|
|
103
|
+
annotations: { readOnlyHint: false, destructiveHint: true },
|
|
104
|
+
}, async ({ id }) => runCliAsTool(["properties", "--delete", String(id)]));
|
|
105
|
+
server.registerTool("rubien_create_option", {
|
|
106
|
+
title: "Create select option (creates a Tag for the Tags property)",
|
|
100
107
|
description: "Append an option to a singleSelect/multiSelect property. " +
|
|
101
108
|
"For the built-in Tags property, this creates a new Tag row with `value` as the tag name " +
|
|
102
|
-
"and `color` as the tag color; the returned option's `value` is the new tag's stable id."
|
|
109
|
+
"and `color` as the tag color; the returned option's `value` is the new tag's stable id." +
|
|
110
|
+
assignmentPointer,
|
|
103
111
|
inputSchema: {
|
|
104
|
-
|
|
112
|
+
propertyId: z.number().int().describe("Property ID"),
|
|
105
113
|
value: z
|
|
106
114
|
.string()
|
|
107
115
|
.describe("Option label (or, for Tags, the new tag's display name)"),
|
|
108
|
-
color: z.string().optional().describe("Optional hex color"),
|
|
116
|
+
color: z.string().optional().describe("Optional hex color (#RRGGBB)"),
|
|
109
117
|
},
|
|
110
|
-
|
|
118
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
119
|
+
}, async ({ propertyId, value, color }) => runCliAsTool([
|
|
111
120
|
"properties",
|
|
112
121
|
"--add-option",
|
|
113
122
|
"--id",
|
|
114
|
-
|
|
123
|
+
String(propertyId),
|
|
115
124
|
...flagsFromOptions({ "--value": value, "--color": color }),
|
|
116
125
|
]));
|
|
117
|
-
server.registerTool("
|
|
118
|
-
title: "
|
|
119
|
-
description: "Rename an existing option on a singleSelect/multiSelect property
|
|
120
|
-
"For Tags: `
|
|
121
|
-
|
|
126
|
+
server.registerTool("rubien_update_option", {
|
|
127
|
+
title: "Update a select option (rename and/or recolor)",
|
|
128
|
+
description: "Rename and/or recolor an existing option on a singleSelect/multiSelect property, in one transaction. `option` addresses the option by its original identity; at least one of `name` / `color` is required. Renames bulk-update affected references. " +
|
|
129
|
+
"For Tags: `option` is the stringified tag id (identity-stable), `name` is the new display name, recolor updates the Tag row. `color` accepts #RRGGBB only. The built-in Type property's options are fully immutable (recolor included)." +
|
|
130
|
+
assignmentPointer,
|
|
122
131
|
inputSchema: {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
132
|
+
propertyId: z.number().int().describe("Property ID"),
|
|
133
|
+
option: z.string().describe("Existing option value (stringified tag id for Tags)"),
|
|
134
|
+
name: z.string().optional().describe("New option value (new tag name for Tags)"),
|
|
135
|
+
color: z.string().optional().describe("New hex color (#RRGGBB)"),
|
|
126
136
|
},
|
|
127
|
-
|
|
137
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
138
|
+
}, async ({ propertyId, option, name, color }) => runCliAsTool([
|
|
128
139
|
"properties",
|
|
129
|
-
"--
|
|
140
|
+
"--update-option",
|
|
130
141
|
"--id",
|
|
131
|
-
|
|
132
|
-
"--
|
|
133
|
-
|
|
134
|
-
"--to",
|
|
135
|
-
to,
|
|
142
|
+
String(propertyId),
|
|
143
|
+
"--option",
|
|
144
|
+
option,
|
|
145
|
+
...flagsFromOptions({ "--to": name, "--color": color }),
|
|
136
146
|
]));
|
|
137
|
-
server.registerTool("
|
|
147
|
+
server.registerTool("rubien_delete_option", {
|
|
138
148
|
title: "Delete a select option (deletes the underlying Tag for Tags)",
|
|
139
149
|
description: "Remove a select option from a property. " + tagsContractNote("For Tags, deleting a tag with attached references requires `replaceWith` (the stringified id of another tag) — affected references are re-tagged before the old tag is removed. Without `replaceWith`, in-use options surface an `optionInUse` error.") +
|
|
140
|
-
" To delete an in-use option without migrating, set `clearInUse: true` — affected references have the option cleared from their value (singleSelect loses its value; multiSelect drops just this option). `clearInUse` and `replaceWith` are mutually exclusive."
|
|
150
|
+
" To delete an in-use option without migrating, set `clearInUse: true` — affected references have the option cleared from their value (singleSelect loses its value; multiSelect drops just this option). `clearInUse` and `replaceWith` are mutually exclusive." +
|
|
151
|
+
assignmentPointer,
|
|
141
152
|
inputSchema: {
|
|
142
|
-
|
|
143
|
-
value: z.string().describe("Option value to delete (tag id for Tags)"),
|
|
153
|
+
propertyId: z.number().int().describe("Property ID"),
|
|
154
|
+
value: z.string().describe("Option value to delete (stringified tag id for Tags)"),
|
|
144
155
|
replaceWith: z
|
|
145
156
|
.string()
|
|
146
157
|
.optional()
|
|
@@ -150,12 +161,12 @@ export function registerPropertyTools(server) {
|
|
|
150
161
|
.optional()
|
|
151
162
|
.describe("Clear the option from affected references instead of migrating. Mutually exclusive with replaceWith."),
|
|
152
163
|
},
|
|
153
|
-
annotations: { destructiveHint: true },
|
|
154
|
-
}, async ({
|
|
164
|
+
annotations: { readOnlyHint: false, destructiveHint: true },
|
|
165
|
+
}, async ({ propertyId, value, replaceWith, clearInUse }) => runCliAsTool([
|
|
155
166
|
"properties",
|
|
156
167
|
"--delete-option",
|
|
157
168
|
"--id",
|
|
158
|
-
|
|
169
|
+
String(propertyId),
|
|
159
170
|
"--value",
|
|
160
171
|
value,
|
|
161
172
|
...flagsFromOptions({
|
|
@@ -163,85 +174,5 @@ export function registerPropertyTools(server) {
|
|
|
163
174
|
"--clear-in-use": clearInUse,
|
|
164
175
|
}),
|
|
165
176
|
]));
|
|
166
|
-
server.registerTool("rubien_properties_set", {
|
|
167
|
-
title: "Set property value on reference (replace semantics)",
|
|
168
|
-
description: "Assign a property value to a reference using replace semantics. For multiSelect (incl. Tags), pass comma-separated values — the existing set is overwritten. " +
|
|
169
|
-
"Use rubien_properties_add_values / rubien_properties_remove_values for incremental edits. " +
|
|
170
|
-
tagsContractNote(),
|
|
171
|
-
inputSchema: {
|
|
172
|
-
reference: z.number().int(),
|
|
173
|
-
id: z.string().describe("Property ID"),
|
|
174
|
-
value: z.string(),
|
|
175
|
-
},
|
|
176
|
-
}, async ({ reference, id, value }) => runCliAsTool([
|
|
177
|
-
"properties",
|
|
178
|
-
"--set",
|
|
179
|
-
"--reference",
|
|
180
|
-
String(reference),
|
|
181
|
-
"--id",
|
|
182
|
-
id,
|
|
183
|
-
"--value",
|
|
184
|
-
value,
|
|
185
|
-
]));
|
|
186
|
-
server.registerTool("rubien_properties_add_values", {
|
|
187
|
-
title: "Add values to a multiSelect property (additive, idempotent)",
|
|
188
|
-
description: "Append one or more values to a multiSelect property on a reference without disturbing existing selections. " +
|
|
189
|
-
"Idempotent: re-adding a present value is a no-op (no sync churn). " +
|
|
190
|
-
tagsContractNote("For Tags this inserts ReferenceTag pivots."),
|
|
191
|
-
inputSchema: {
|
|
192
|
-
reference: z.number().int(),
|
|
193
|
-
id: z.string().describe("Property ID"),
|
|
194
|
-
value: z.string().describe("Comma-separated values (tag IDs for Tags)"),
|
|
195
|
-
},
|
|
196
|
-
}, async ({ reference, id, value }) => runCliAsTool([
|
|
197
|
-
"properties",
|
|
198
|
-
"--set",
|
|
199
|
-
"--add-value",
|
|
200
|
-
"--reference",
|
|
201
|
-
String(reference),
|
|
202
|
-
"--id",
|
|
203
|
-
id,
|
|
204
|
-
"--value",
|
|
205
|
-
value,
|
|
206
|
-
]));
|
|
207
|
-
server.registerTool("rubien_properties_remove_values", {
|
|
208
|
-
title: "Remove values from a multiSelect property (subtractive, idempotent)",
|
|
209
|
-
description: "Remove one or more values from a multiSelect property on a reference without disturbing other selections. " +
|
|
210
|
-
"Idempotent: removing an absent value is a no-op. " +
|
|
211
|
-
tagsContractNote("For Tags this deletes ReferenceTag pivots."),
|
|
212
|
-
inputSchema: {
|
|
213
|
-
reference: z.number().int(),
|
|
214
|
-
id: z.string().describe("Property ID"),
|
|
215
|
-
value: z.string().describe("Comma-separated values (tag IDs for Tags)"),
|
|
216
|
-
},
|
|
217
|
-
annotations: { destructiveHint: true },
|
|
218
|
-
}, async ({ reference, id, value }) => runCliAsTool([
|
|
219
|
-
"properties",
|
|
220
|
-
"--set",
|
|
221
|
-
"--remove-value",
|
|
222
|
-
"--reference",
|
|
223
|
-
String(reference),
|
|
224
|
-
"--id",
|
|
225
|
-
id,
|
|
226
|
-
"--value",
|
|
227
|
-
value,
|
|
228
|
-
]));
|
|
229
|
-
server.registerTool("rubien_properties_clear", {
|
|
230
|
-
title: "Clear property value on reference",
|
|
231
|
-
description: "Remove a property value from a reference. " +
|
|
232
|
-
tagsContractNote("For Tags this removes all of the reference's tag assignments."),
|
|
233
|
-
inputSchema: {
|
|
234
|
-
reference: z.number().int(),
|
|
235
|
-
id: z.string().describe("Property ID"),
|
|
236
|
-
},
|
|
237
|
-
annotations: { destructiveHint: true },
|
|
238
|
-
}, async ({ reference, id }) => runCliAsTool([
|
|
239
|
-
"properties",
|
|
240
|
-
"--clear",
|
|
241
|
-
"--reference",
|
|
242
|
-
String(reference),
|
|
243
|
-
"--id",
|
|
244
|
-
id,
|
|
245
|
-
]));
|
|
246
177
|
}
|
|
247
178
|
//# sourceMappingURL=properties.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../src/tools/properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEnE,MAAM,cAAc,GAAG;IACrB,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,cAAc;IACd,a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EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,EAAE,CACvD,YAAY,CAAC;QACX,YAAY;QACZ,iBAAiB;QACjB,MAAM;QACN,MAAM,CAAC,UAAU,CAAC;QAClB,SAAS;QACT,KAAK;QACL,GAAG,gBAAgB,CAAC;YAClB,gBAAgB,EAAE,WAAW;YAC7B,gBAAgB,EAAE,UAAU;SAC7B,CAAC;KACH,CAAC,CACL,CAAC;AACJ,CAAC"}
|
package/dist/tools/read.js
CHANGED
|
@@ -3,7 +3,7 @@ import { flagsFromOptions, runCliAsTool } from "../toolHelpers.js";
|
|
|
3
3
|
export function registerReadTools(server) {
|
|
4
4
|
server.registerTool("rubien_read_text", {
|
|
5
5
|
title: "Read the body text of any reference",
|
|
6
|
-
description: "Return the readable body text of any reference — its attached PDF or its clipped web page — without needing to know which it has. Source selection when `source` is omitted: `pages`/`sections` imply pdf, `start` implies web, otherwise PDF wins when both exist. Every response carries `source` (what was read) and `available` (which sources are readable now, e.g. [\"pdf\",\"web\"]). PDF responses are page-keyed: each `pages[]` item carries `text` and `sectionPath`, selected via `pages` ('1-3' or '1-3,8-10') or `sections` (title substrings, case-insensitive; errors `no-outline` when the PDF has no outline — fall back to `pages`). Web responses are one flat windowed body: `content` + `contentLength`, paginated via `start`/`maxChars`; `contentFormat` is \"markdown\" or \"html\" (treat html as a fragment). To find WHERE the body mentions something before reading, use `rubien_grep_text`. Library-only — never fetches from the network. Use `rubien_read_annotations` for the user's highlights/notes, and `
|
|
6
|
+
description: "Return the readable body text of any reference — its attached PDF or its clipped web page — without needing to know which it has. Source selection when `source` is omitted: `pages`/`sections` imply pdf, `start` implies web, otherwise PDF wins when both exist. Every response carries `source` (what was read) and `available` (which sources are readable now, e.g. [\"pdf\",\"web\"]). PDF responses are page-keyed: each `pages[]` item carries `text` and `sectionPath`, selected via `pages` ('1-3' or '1-3,8-10') or `sections` (title substrings, case-insensitive; errors `no-outline` when the PDF has no outline — fall back to `pages`). Web responses are one flat windowed body: `content` + `contentLength`, paginated via `start`/`maxChars`; `contentFormat` is \"markdown\" or \"html\" (treat html as a fragment). To find WHERE the body mentions something before reading, use `rubien_grep_text`. Library-only — never fetches from the network. Use `rubien_read_annotations` for the user's highlights/notes, and `rubien_get_pdf_info` first when you plan to select by `sections`.",
|
|
7
7
|
inputSchema: {
|
|
8
8
|
id: z.number().int().describe("Reference ID"),
|
|
9
9
|
source: z.enum(["pdf", "web"]).optional()
|
|
@@ -60,7 +60,7 @@ export function registerReadTools(server) {
|
|
|
60
60
|
});
|
|
61
61
|
server.registerTool("rubien_grep_text", {
|
|
62
62
|
title: "Find where a reference's body says something",
|
|
63
|
-
description: "Find WHERE a phrase or regex occurs inside one reference's body text — its attached PDF or its clipped web page — without retrieving the body. Returns anchored locations, not text: PDF hits are page-grouped (`pages[]` with `page`, `sectionPath` breadcrumbs, `matchCount`, snippets) — drill in with `rubien_read_text` + `pages`; web hits carry exact character offsets (`matches[].start`, same coordinates as `rubien_read_text`'s `start`) — drill in with `rubien_read_text` + `start`. Matching is case-insensitive (`regex: true` treats the query as a regular expression; `(?-i:…)` restores case). Source selection mirrors `rubien_read_text`: explicit `source` wins; `pages`/`maxPages`/`snippetsPerPage` imply pdf and `maxMatches` implies web; otherwise PDF wins when both exist. Every response carries `source` and `available`. A scanned PDF returns success with `hasTextLayer: false` and no hits — fall back to `
|
|
63
|
+
description: "Find WHERE a phrase or regex occurs inside one reference's body text — its attached PDF or its clipped web page — without retrieving the body. Returns anchored locations, not text: PDF hits are page-grouped (`pages[]` with `page`, `sectionPath` breadcrumbs, `matchCount`, snippets) — drill in with `rubien_read_text` + `pages`; web hits carry exact character offsets (`matches[].start`, same coordinates as `rubien_read_text`'s `start`) — drill in with `rubien_read_text` + `start`. Matching is case-insensitive (`regex: true` treats the query as a regular expression; `(?-i:…)` restores case). Source selection mirrors `rubien_read_text`: explicit `source` wins; `pages`/`maxPages`/`snippetsPerPage` imply pdf and `maxMatches` implies web; otherwise PDF wins when both exist. Every response carries `source` and `available`. A scanned PDF returns success with `hasTextLayer: false` and no hits — fall back to `rubien_render_pdf_page`. To find which REFERENCES match, use `rubien_search_references` (library metadata) instead. Library-only — never fetches from the network.",
|
|
64
64
|
inputSchema: {
|
|
65
65
|
id: z.number().int().describe("Reference ID"),
|
|
66
66
|
query: z.string().min(1).describe("Literal phrase (default) or regex (`regex: true`). Case-insensitive."),
|
package/dist/tools/read.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEnE,MAAM,UAAU,iBAAiB,CAAC,MAAiB;IACjD,MAAM,CAAC,YAAY,CACjB,kBAAkB,EAClB;QACE,KAAK,EAAE,qCAAqC;QAC5C,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEnE,MAAM,UAAU,iBAAiB,CAAC,MAAiB;IACjD,MAAM,CAAC,YAAY,CACjB,kBAAkB,EAClB;QACE,KAAK,EAAE,qCAAqC;QAC5C,WAAW,EACT,kjCAAkjC;QACpjC,WAAW,EAAE;YACX,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;YAC7C,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE;iBACtC,QAAQ,CAAC,sFAAsF,CAAC;YACnG,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,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