@abraca/mcp 1.0.2 → 1.0.5
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/dist/abracadabra-mcp.cjs +35 -11
- package/dist/abracadabra-mcp.cjs.map +1 -1
- package/dist/abracadabra-mcp.esm.js +35 -11
- package/dist/abracadabra-mcp.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/tools/tree.ts +31 -11
|
@@ -18778,7 +18778,10 @@ function childrenOf$1(entries, parentId) {
|
|
|
18778
18778
|
}
|
|
18779
18779
|
function descendantsOf(entries, id) {
|
|
18780
18780
|
const result = [];
|
|
18781
|
+
const visited = /* @__PURE__ */ new Set();
|
|
18781
18782
|
function collect(pid) {
|
|
18783
|
+
if (visited.has(pid)) return;
|
|
18784
|
+
visited.add(pid);
|
|
18782
18785
|
for (const child of childrenOf$1(entries, pid)) {
|
|
18783
18786
|
result.push(child);
|
|
18784
18787
|
collect(child.id);
|
|
@@ -18787,18 +18790,39 @@ function descendantsOf(entries, id) {
|
|
|
18787
18790
|
collect(id);
|
|
18788
18791
|
return result;
|
|
18789
18792
|
}
|
|
18790
|
-
function buildTree$1(entries, rootId, maxDepth, currentDepth = 0) {
|
|
18793
|
+
function buildTree$1(entries, rootId, maxDepth, currentDepth = 0, visited = /* @__PURE__ */ new Set()) {
|
|
18791
18794
|
if (maxDepth >= 0 && currentDepth >= maxDepth) return [];
|
|
18792
|
-
return childrenOf$1(entries, rootId).map((entry) =>
|
|
18793
|
-
|
|
18794
|
-
|
|
18795
|
-
|
|
18796
|
-
|
|
18797
|
-
|
|
18798
|
-
|
|
18799
|
-
|
|
18795
|
+
return childrenOf$1(entries, rootId).filter((e) => !visited.has(e.id)).map((entry) => {
|
|
18796
|
+
const next = new Set(visited);
|
|
18797
|
+
next.add(entry.id);
|
|
18798
|
+
return {
|
|
18799
|
+
id: entry.id,
|
|
18800
|
+
label: entry.label,
|
|
18801
|
+
type: entry.type,
|
|
18802
|
+
meta: entry.meta,
|
|
18803
|
+
order: entry.order,
|
|
18804
|
+
children: buildTree$1(entries, entry.id, maxDepth, currentDepth + 1, next)
|
|
18805
|
+
};
|
|
18806
|
+
});
|
|
18800
18807
|
}
|
|
18801
18808
|
function registerTreeTools(mcp, server) {
|
|
18809
|
+
mcp.tool("_debug_list_all", "List ALL tree entries with their raw parentId. For debugging circular references.", {}, async () => {
|
|
18810
|
+
const treeMap = server.getTreeMap();
|
|
18811
|
+
if (!treeMap) return { content: [{
|
|
18812
|
+
type: "text",
|
|
18813
|
+
text: "Not connected"
|
|
18814
|
+
}] };
|
|
18815
|
+
const entries = readEntries$1(treeMap);
|
|
18816
|
+
return { content: [{
|
|
18817
|
+
type: "text",
|
|
18818
|
+
text: JSON.stringify(entries.map((e) => ({
|
|
18819
|
+
id: e.id,
|
|
18820
|
+
label: e.label,
|
|
18821
|
+
parentId: e.parentId,
|
|
18822
|
+
type: e.type
|
|
18823
|
+
})), null, 2)
|
|
18824
|
+
}] };
|
|
18825
|
+
});
|
|
18802
18826
|
mcp.tool("list_documents", "List direct children of a document (defaults to root). Returns id, label, type, meta, order.", { parentId: z.string().optional().describe("Parent document ID. Omit for root-level documents.") }, async ({ parentId }) => {
|
|
18803
18827
|
const treeMap = server.getTreeMap();
|
|
18804
18828
|
if (!treeMap) return { content: [{
|
|
@@ -18832,7 +18856,7 @@ function registerTreeTools(mcp, server) {
|
|
|
18832
18856
|
mcp.tool("create_document", "Create a new document in the tree. Returns the new document ID.", {
|
|
18833
18857
|
parentId: z.string().optional().describe("Parent document ID. Omit for top-level pages. Use a document ID for nested/child pages."),
|
|
18834
18858
|
label: z.string().describe("Display name / title for the document."),
|
|
18835
|
-
type: z.string().optional().describe("Page type: \"doc\", \"kanban\", \"calendar\", \"table\", \"outline\", \"gallery\", \"slides\", \"timeline\", \"whiteboard\", \"map\", \"
|
|
18859
|
+
type: z.string().optional().describe("Page type: \"doc\", \"kanban\", \"calendar\", \"table\", \"outline\", \"gallery\", \"slides\", \"timeline\", \"whiteboard\", \"map\", \"dashboard\", \"mindmap\", \"graph\". Omit to inherit parent view."),
|
|
18836
18860
|
meta: z.record(z.unknown()).optional().describe("Initial metadata (PageMeta fields: color as hex string, icon as Lucide kebab-case name like \"star\"/\"code-2\"/\"users\" — never emoji, dateStart, dateEnd, priority 0-4, tags array, etc). Omit icon entirely to use page type default.")
|
|
18837
18861
|
}, async ({ parentId, label, type, meta }) => {
|
|
18838
18862
|
const treeMap = server.getTreeMap();
|
|
@@ -18946,7 +18970,7 @@ function registerTreeTools(mcp, server) {
|
|
|
18946
18970
|
});
|
|
18947
18971
|
mcp.tool("change_document_type", "Change the page type view of a document (data is preserved).", {
|
|
18948
18972
|
id: z.string().describe("Document ID."),
|
|
18949
|
-
type: z.string().describe("New page type (e.g. \"doc\", \"kanban\", \"table\", \"calendar\", \"outline\", \"gallery\", \"slides\", \"timeline\", \"whiteboard\", \"map\", \"
|
|
18973
|
+
type: z.string().describe("New page type (e.g. \"doc\", \"kanban\", \"table\", \"calendar\", \"outline\", \"gallery\", \"slides\", \"timeline\", \"whiteboard\", \"map\", \"dashboard\", \"mindmap\", \"graph\").")
|
|
18950
18974
|
}, async ({ id, type }) => {
|
|
18951
18975
|
const treeMap = server.getTreeMap();
|
|
18952
18976
|
if (!treeMap) return { content: [{
|