@roam-research/roam-tools-core 0.5.0 → 0.5.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.
Files changed (39) hide show
  1. package/dist/client.d.ts.map +1 -1
  2. package/dist/client.js +1 -1
  3. package/dist/connect.d.ts.map +1 -1
  4. package/dist/connect.js +6 -8
  5. package/dist/graph-resolver.d.ts.map +1 -1
  6. package/dist/graph-resolver.js +2 -1
  7. package/dist/index.d.ts +3 -3
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +1 -1
  10. package/dist/operations/blocks.d.ts +16 -10
  11. package/dist/operations/blocks.d.ts.map +1 -1
  12. package/dist/operations/blocks.js +66 -15
  13. package/dist/operations/datalog.d.ts +16 -0
  14. package/dist/operations/datalog.d.ts.map +1 -0
  15. package/dist/operations/datalog.js +16 -0
  16. package/dist/operations/files.d.ts +2 -2
  17. package/dist/operations/files.d.ts.map +1 -1
  18. package/dist/operations/files.js +18 -5
  19. package/dist/operations/graphs.d.ts.map +1 -1
  20. package/dist/operations/graphs.js +2 -3
  21. package/dist/operations/navigation.d.ts +4 -4
  22. package/dist/operations/navigation.d.ts.map +1 -1
  23. package/dist/operations/navigation.js +4 -1
  24. package/dist/operations/pages.d.ts +9 -6
  25. package/dist/operations/pages.d.ts.map +1 -1
  26. package/dist/operations/pages.js +34 -10
  27. package/dist/operations/query.d.ts +8 -8
  28. package/dist/operations/query.d.ts.map +1 -1
  29. package/dist/operations/query.js +24 -6
  30. package/dist/operations/search.d.ts +4 -4
  31. package/dist/operations/search.d.ts.map +1 -1
  32. package/dist/operations/search.js +22 -6
  33. package/dist/roam-api.d.ts.map +1 -1
  34. package/dist/tools.d.ts.map +1 -1
  35. package/dist/tools.js +47 -31
  36. package/dist/types.d.ts +3 -3
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/types.js +14 -4
  39. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources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C,oBAAoB;IAgC5B;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAiBlC;;OAEG;IACH,OAAO,CAAC,cAAc;IAsCtB,OAAO,CAAC,aAAa;IAMrB;;;OAGG;IACG,YAAY,IAAI,OAAO,CAAC,eAAe,CAAC;IAsCxC,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CAuExF"}
package/dist/client.js CHANGED
@@ -4,7 +4,7 @@ import { readFile } from "fs/promises";
4
4
  import { homedir } from "os";
5
5
  import { join } from "path";
6
6
  import open from "open";
7
- import { EXPECTED_API_VERSION, getErrorMessage, RoamError, ErrorCodes, } from "./types.js";
7
+ import { EXPECTED_API_VERSION, getErrorMessage, RoamError, ErrorCodes } from "./types.js";
8
8
  export class RoamClient {
9
9
  graphName;
10
10
  graphType;
@@ -1 +1 @@
1
- {"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AAgCA,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AA0CD,wBAAsB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgiBzE"}
1
+ {"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AA0CD,wBAAsB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4gBzE"}
package/dist/connect.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { search, select, input } from "@inquirer/prompts";
2
2
  import { getPort, getConfiguredGraphsSafe, saveGraphToConfig, removeGraphFromConfig, } from "./graph-resolver.js";
3
- import { fetchAvailableGraphs, requestToken, sleep, openRoamApp, slugify, } from "./roam-api.js";
3
+ import { fetchAvailableGraphs, requestToken, sleep, openRoamApp, slugify } from "./roam-api.js";
4
4
  // ============================================================================
5
5
  // API Functions
6
6
  // ============================================================================
@@ -121,7 +121,7 @@ export async function connect(options = {}) {
121
121
  try {
122
122
  availableGraphs = await fetchAvailableGraphs(port);
123
123
  }
124
- catch (retryError) {
124
+ catch {
125
125
  console.error("\nCould not connect to Roam Desktop.");
126
126
  console.error("Please make sure Roam is running and try again.");
127
127
  process.exit(1);
@@ -171,8 +171,7 @@ export async function connect(options = {}) {
171
171
  else {
172
172
  // Match against available graphs
173
173
  const graphType = options.type;
174
- const match = availableGraphs.find((g) => g.name === options.graph &&
175
- (!graphType || g.type === graphType));
174
+ const match = availableGraphs.find((g) => g.name === options.graph && (!graphType || g.type === graphType));
176
175
  if (!match) {
177
176
  console.error(`Error: Graph "${options.graph}" not found in available graphs.`);
178
177
  if (availableGraphs.length > 0) {
@@ -243,8 +242,7 @@ export async function connect(options = {}) {
243
242
  source: async (input) => {
244
243
  // Filter available graphs (exclude custom option placeholder)
245
244
  const filtered = input
246
- ? choices.filter((g) => !g.isCustomOption &&
247
- g.name.toLowerCase().includes(input.toLowerCase()))
245
+ ? choices.filter((g) => !g.isCustomOption && g.name.toLowerCase().includes(input.toLowerCase()))
248
246
  : choices.filter((g) => !g.isCustomOption);
249
247
  // Build results with custom option
250
248
  const results = filtered.map((g) => {
@@ -280,7 +278,7 @@ export async function connect(options = {}) {
280
278
  const customName = await input({
281
279
  message: "Enter the graph name:",
282
280
  default: defaultName,
283
- validate: (value) => value.trim() ? true : "Graph name cannot be empty",
281
+ validate: (value) => (value.trim() ? true : "Graph name cannot be empty"),
284
282
  });
285
283
  // Public graphs are always hosted
286
284
  const customType = "hosted";
@@ -370,7 +368,7 @@ export async function connect(options = {}) {
370
368
  console.log("\nTo change this token's permissions:");
371
369
  console.log(" 1. Open Roam Desktop and open the graph");
372
370
  console.log(" 2. Go to Settings > Graph > Local API Tokens");
373
- console.log(' 3. Find the token and adjust its permissions');
371
+ console.log(" 3. Find the token and adjust its permissions");
374
372
  // Permission changes are synced when get_graph_guidelines calls getTokenInfo()
375
373
  console.log("\nChanges will be synced automatically next time the MCP is started.");
376
374
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"graph-resolver.d.ts","sourceRoot":"","sources":["../src/graph-resolver.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,aAAa,EACb,WAAW,EACX,aAAa,EAGb,WAAW,EAEZ,MAAM,YAAY,CAAC;AAyBpB,wBAAsB,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAG/C;AAmCD,wBAAsB,YAAY,IAAI,OAAO,CAAC,aAAa,CAAC,CA4G3D;AA+CD;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA6B5E;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAgB9E;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;IAAE,WAAW,CAAC,EAAE,WAAW,CAAC;IAAC,oBAAoB,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;CAAE,GAClF,OAAO,CAAC,IAAI,CAAC,CAoBf;AAED;;;GAGG;AACH,wBAAs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AAC,oBAAoB,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;CAAE,GAClF,OAAO,CAAC,IAAI,CAAC,CAqBf;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAOtE;AAMD;;GAEG;AACH,wBAAsB,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAU9F;AAED;;GAEG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAClD,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAC9F,CAQA;AAMD;;;GAGG;AACH,wBAAsB,YAAY,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAkDjF;AAiBD;;;;GAIG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAgBpF"}
@@ -223,7 +223,8 @@ export async function updateGraphTokenStatus(nickname, updates) {
223
223
  graph.accessLevel = updates.accessLevel;
224
224
  changed = true;
225
225
  }
226
- if (updates.lastKnownTokenStatus !== undefined && graph.lastKnownTokenStatus !== updates.lastKnownTokenStatus) {
226
+ if (updates.lastKnownTokenStatus !== undefined &&
227
+ graph.lastKnownTokenStatus !== updates.lastKnownTokenStatus) {
227
228
  graph.lastKnownTokenStatus = updates.lastKnownTokenStatus;
228
229
  changed = true;
229
230
  }
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ export type { CallToolResult, TextContent, ImageContent, GraphType, AccessLevel,
2
2
  export { GraphConfigSchema, RoamMcpConfigSchema, ErrorCodes, RoamError, CONFIG_VERSION, EXPECTED_API_VERSION, textResult, imageResult, errorResult, getErrorMessage, } from "./types.js";
3
3
  export { RoamClient } from "./client.js";
4
4
  export { getPort, resolveGraph, saveGraphToConfig, removeGraphFromConfig, updateGraphTokenStatus, getConfiguredGraphsSafe, getConfiguredGraphs, findGraphConfig, getMcpConfig, getOpenGraphs, } from "./graph-resolver.js";
5
- export { fetchAvailableGraphs, requestToken, sleep, openRoamApp, slugify, } from "./roam-api.js";
6
- export type { AvailableGraph, GraphsResponse, TokenExchangeResponse, } from "./roam-api.js";
5
+ export { fetchAvailableGraphs, requestToken, sleep, openRoamApp, slugify } from "./roam-api.js";
6
+ export type { AvailableGraph, GraphsResponse, TokenExchangeResponse } from "./roam-api.js";
7
7
  export { tools, findTool, routeToolCall } from "./tools.js";
8
- export type { ToolDefinition, ClientToolDefinition, StandaloneToolDefinition, } from "./tools.js";
8
+ export type { ToolDefinition, ClientToolDefinition, StandaloneToolDefinition } from "./tools.js";
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,cAAc,EAAE,WAAW,EAAE,YAAY,EACzC,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EACjE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EACvD,KAAK,EAAE,IAAI,EAAE,aAAa,EAC1B,UAAU,EAAE,aAAa,EAAE,iBAAiB,EAC5C,YAAY,EAAE,aAAa,EAC3B,kBAAkB,EAAE,cAAc,EAClC,gBAAgB,EAAE,YAAY,EAAE,cAAc,EAC9C,mBAAmB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,kBAAkB,EACnF,yBAAyB,EAAE,uBAAuB,EAClD,eAAe,EAAE,gBAAgB,EACjC,QAAQ,EAAE,WAAW,EAAE,aAAa,EACpC,iBAAiB,EAAE,eAAe,GACnC,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iBAAiB,E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MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,cAAc,EACd,oBAAoB,EACpB,UAAU,EACV,WAAW,EACX,WAAW,EACX,eAAe,GAChB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EACL,OAAO,EACP,YAAY,EACZ,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,YAAY,EACZ,aAAa,GACd,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAChG,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAG3F,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -5,6 +5,6 @@ export { RoamClient } from "./client.js";
5
5
  // Graph resolution and config management
6
6
  export { getPort, resolveGraph, saveGraphToConfig, removeGraphFromConfig, updateGraphTokenStatus, getConfiguredGraphsSafe, getConfiguredGraphs, findGraphConfig, getMcpConfig, getOpenGraphs, } from "./graph-resolver.js";
7
7
  // Shared Roam API functions
8
- export { fetchAvailableGraphs, requestToken, sleep, openRoamApp, slugify, } from "./roam-api.js";
8
+ export { fetchAvailableGraphs, requestToken, sleep, openRoamApp, slugify } from "./roam-api.js";
9
9
  // Tool definitions and routing
10
10
  export { tools, findTool, routeToolCall } from "./tools.js";
@@ -38,16 +38,22 @@ export declare const UpdateBlockSchema: z.ZodObject<{
38
38
  string: z.ZodOptional<z.ZodString>;
39
39
  open: z.ZodOptional<z.ZodBoolean>;
40
40
  heading: z.ZodOptional<z.ZodNumber>;
41
+ childrenViewType: z.ZodOptional<z.ZodEnum<["bullet", "numbered", "document"]>>;
42
+ textAlign: z.ZodOptional<z.ZodEnum<["left", "center", "right", "justify"]>>;
41
43
  }, "strip", z.ZodTypeAny, {
42
44
  uid: string;
43
45
  string?: string | undefined;
46
+ childrenViewType?: "bullet" | "numbered" | "document" | undefined;
44
47
  open?: boolean | undefined;
45
48
  heading?: number | undefined;
49
+ textAlign?: "left" | "center" | "right" | "justify" | undefined;
46
50
  }, {
47
51
  uid: string;
48
52
  string?: string | undefined;
53
+ childrenViewType?: "bullet" | "numbered" | "document" | undefined;
49
54
  open?: boolean | undefined;
50
55
  heading?: number | undefined;
56
+ textAlign?: "left" | "center" | "right" | "justify" | undefined;
51
57
  }>;
52
58
  export declare const DeleteBlockSchema: z.ZodObject<{
53
59
  uid: z.ZodString;
@@ -80,25 +86,25 @@ export declare const GetBacklinksSchema: z.ZodObject<{
80
86
  includePath: z.ZodOptional<z.ZodBoolean>;
81
87
  maxDepth: z.ZodOptional<z.ZodNumber>;
82
88
  }, "strip", z.ZodTypeAny, {
89
+ title?: string | undefined;
83
90
  sort?: "created-date" | "edited-date" | "daily-note-date" | undefined;
91
+ search?: string | undefined;
84
92
  uid?: string | undefined;
85
- title?: string | undefined;
86
- sortOrder?: "asc" | "desc" | undefined;
87
- includePath?: boolean | undefined;
93
+ maxDepth?: number | undefined;
88
94
  offset?: number | undefined;
89
95
  limit?: number | undefined;
90
- maxDepth?: number | undefined;
91
- search?: string | undefined;
96
+ sortOrder?: "asc" | "desc" | undefined;
97
+ includePath?: boolean | undefined;
92
98
  }, {
99
+ title?: string | undefined;
93
100
  sort?: "created-date" | "edited-date" | "daily-note-date" | undefined;
101
+ search?: string | undefined;
94
102
  uid?: string | undefined;
95
- title?: string | undefined;
96
- sortOrder?: "asc" | "desc" | undefined;
97
- includePath?: boolean | undefined;
103
+ maxDepth?: number | undefined;
98
104
  offset?: number | undefined;
99
105
  limit?: number | undefined;
100
- maxDepth?: number | undefined;
101
- search?: string | undefined;
106
+ sortOrder?: "asc" | "desc" | undefined;
107
+ includePath?: boolean | undefined;
102
108
  }>;
103
109
  export type CreateBlockParams = z.infer<typeof CreateBlockSchema>;
104
110
  export type GetBlockParams = z.infer<typeof GetBlockSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/operations/blocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,aAAa,CAAC;AAIpE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;EAiB5B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;EAGzB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAK5B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;EAE5B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;EAI1B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU7B,CAAC;AAGH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC5D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,MAAM,MAAM,kBAAkB,GAAG,C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MzB"}
@@ -2,22 +2,46 @@ import { z } from "zod";
2
2
  import { textResult, RoamError, ErrorCodes } from "../types.js";
3
3
  // Schemas
4
4
  export const CreateBlockSchema = z.object({
5
- parentUid: z.string().optional().describe("UID of parent block or page. Exactly one of parentUid, pageTitle, or dailyNotePage is required."),
6
- pageTitle: z.string().optional().describe("Page title to create block under (creates the page if it doesn't exist). Exactly one of parentUid, pageTitle, or dailyNotePage is required."),
7
- dailyNotePage: z.string().regex(/^\d{2}-\d{2}-\d{4}$/, "Must be MM-DD-YYYY format (e.g. '03-17-2026')").optional().describe("Daily note date in MM-DD-YYYY format (e.g. '03-17-2026'). Targets that day's daily note page, creating it if needed. Exactly one of parentUid, pageTitle, or dailyNotePage is required."),
8
- nestUnder: z.string().optional().describe("Insert under a direct child block matching this string (matches on the block's string field, including markup like **bold** or [[links]]). If no match exists, creates a new child block with this text first, then inserts under it. Works with parentUid, pageTitle, or dailyNotePage."),
5
+ parentUid: z
6
+ .string()
7
+ .optional()
8
+ .describe("UID of parent block or page. Exactly one of parentUid, pageTitle, or dailyNotePage is required."),
9
+ pageTitle: z
10
+ .string()
11
+ .optional()
12
+ .describe("Page title to create block under (creates the page if it doesn't exist). Exactly one of parentUid, pageTitle, or dailyNotePage is required."),
13
+ dailyNotePage: z
14
+ .string()
15
+ .regex(/^\d{2}-\d{2}-\d{4}$/, "Must be MM-DD-YYYY format (e.g. '03-17-2026')")
16
+ .optional()
17
+ .describe("Daily note date in MM-DD-YYYY format (e.g. '03-17-2026'). Targets that day's daily note page, creating it if needed. Exactly one of parentUid, pageTitle, or dailyNotePage is required."),
18
+ nestUnder: z
19
+ .string()
20
+ .optional()
21
+ .describe("Insert under a direct child block matching this string (matches on the block's string field, including markup like **bold** or [[links]]). If no match exists, creates a new child block with this text first, then inserts under it. Works with parentUid, pageTitle, or dailyNotePage."),
9
22
  markdown: z.string().describe("Markdown content for the block"),
10
- order: z.union([z.coerce.number(), z.enum(["first", "last"])]).optional().describe("Position (number, 'first', or 'last'). Defaults to 'last'"),
23
+ order: z
24
+ .union([z.coerce.number(), z.enum(["first", "last"])])
25
+ .optional()
26
+ .describe("Position (number, 'first', or 'last'). Defaults to 'last'"),
11
27
  });
12
28
  export const GetBlockSchema = z.object({
13
29
  uid: z.string().describe("Block UID"),
14
- maxDepth: z.coerce.number().optional().describe("Max depth of children to include in markdown (omit for full tree)"),
30
+ maxDepth: z.coerce
31
+ .number()
32
+ .optional()
33
+ .describe("Max depth of children to include in markdown (omit for full tree)"),
15
34
  });
16
35
  export const UpdateBlockSchema = z.object({
17
36
  uid: z.string().describe("Block UID"),
18
37
  string: z.string().optional().describe("New text content"),
19
38
  open: z.boolean().optional().describe("Collapse state"),
20
39
  heading: z.coerce.number().optional().describe("Heading level (0-3)"),
40
+ childrenViewType: z
41
+ .enum(["bullet", "numbered", "document"])
42
+ .optional()
43
+ .describe("How children are displayed (bullet, numbered, or document)"),
44
+ textAlign: z.enum(["left", "center", "right", "justify"]).optional().describe("Text alignment"),
21
45
  });
22
46
  export const DeleteBlockSchema = z.object({
23
47
  uid: z.string().describe("Block UID to delete"),
@@ -25,22 +49,36 @@ export const DeleteBlockSchema = z.object({
25
49
  export const MoveBlockSchema = z.object({
26
50
  uid: z.string().describe("Block UID to move"),
27
51
  parentUid: z.string().describe("UID of the new parent block or page"),
28
- order: z.union([z.coerce.number(), z.enum(["first", "last"])]).describe("Position in the new parent (number, 'first', or 'last')"),
52
+ order: z
53
+ .union([z.coerce.number(), z.enum(["first", "last"])])
54
+ .describe("Position in the new parent (number, 'first', or 'last')"),
29
55
  });
30
56
  export const GetBacklinksSchema = z.object({
31
57
  uid: z.string().optional().describe("UID of page or block (required if no title)"),
32
58
  title: z.string().optional().describe("Page title (required if no uid)"),
33
59
  offset: z.coerce.number().optional().describe("Skip first N results (default: 0)"),
34
60
  limit: z.coerce.number().optional().describe("Max results to return (default: 20)"),
35
- sort: z.enum(["created-date", "edited-date", "daily-note-date"]).optional().describe("Sort order (default: created-date)"),
61
+ sort: z
62
+ .enum(["created-date", "edited-date", "daily-note-date"])
63
+ .optional()
64
+ .describe("Sort order (default: created-date)"),
36
65
  sortOrder: z.enum(["asc", "desc"]).optional().describe("Sort direction (default: desc)"),
37
- search: z.string().optional().describe("Filter results by text match (searches block, parents, children, page title)"),
38
- includePath: z.boolean().optional().describe("Include breadcrumb path to each result (default: true)"),
39
- maxDepth: z.coerce.number().optional().describe("Max depth of children to include in markdown (default: 2)"),
66
+ search: z
67
+ .string()
68
+ .optional()
69
+ .describe("Filter results by text match (searches block, parents, children, page title)"),
70
+ includePath: z
71
+ .boolean()
72
+ .optional()
73
+ .describe("Include breadcrumb path to each result (default: true)"),
74
+ maxDepth: z.coerce
75
+ .number()
76
+ .optional()
77
+ .describe("Max depth of children to include in markdown (default: 2)"),
40
78
  });
41
79
  export async function createBlock(client, params) {
42
80
  // Validate: exactly one of parentUid, pageTitle, or dailyNotePage
43
- const targets = [params.parentUid, params.pageTitle, params.dailyNotePage].filter(v => v !== undefined);
81
+ const targets = [params.parentUid, params.pageTitle, params.dailyNotePage].filter((v) => v !== undefined);
44
82
  if (targets.length === 0) {
45
83
  throw new RoamError("Either 'parentUid', 'pageTitle', or 'dailyNotePage' is required to specify where to create the block", ErrorCodes.VALIDATION_ERROR);
46
84
  }
@@ -82,6 +120,10 @@ export async function updateBlock(client, params) {
82
120
  block.open = params.open;
83
121
  if (params.heading !== undefined)
84
122
  block.heading = params.heading;
123
+ if (params.childrenViewType !== undefined)
124
+ block["children-view-type"] = params.childrenViewType;
125
+ if (params.textAlign !== undefined)
126
+ block["text-align"] = params.textAlign;
85
127
  await client.call("data.block.update", [{ block }]);
86
128
  return textResult({ success: true });
87
129
  }
@@ -129,12 +171,21 @@ export async function getBacklinks(client, params) {
129
171
  // --- Comments ---
130
172
  export const AddCommentSchema = z.object({
131
173
  blockUid: z.string().describe("UID of the block to comment on"),
132
- comment: z.string().optional().describe("Plain text comment (single block, editable later via update_block). Required if commentMarkdown not provided. Preferred for simple comments."),
133
- commentMarkdown: z.string().optional().describe("Markdown comment parsed into multiple blocks. Required if comment not provided. Use only when you need structure (lists, headings). Harder to edit later."),
174
+ comment: z
175
+ .string()
176
+ .optional()
177
+ .describe("Plain text comment (single block, editable later via update_block). Required if commentMarkdown not provided. Preferred for simple comments."),
178
+ commentMarkdown: z
179
+ .string()
180
+ .optional()
181
+ .describe("Markdown comment parsed into multiple blocks. Required if comment not provided. Use only when you need structure (lists, headings). Harder to edit later."),
134
182
  });
135
183
  export const GetCommentsSchema = z.object({
136
184
  blockUid: z.string().describe("UID of the block to get comments for"),
137
- maxDepth: z.coerce.number().optional().describe("Max depth of children to include in each comment's markdown (omit for full tree)"),
185
+ maxDepth: z.coerce
186
+ .number()
187
+ .optional()
188
+ .describe("Max depth of children to include in each comment's markdown (omit for full tree)"),
138
189
  });
139
190
  export async function addComment(client, params) {
140
191
  // Validate: exactly one of comment or commentMarkdown must be provided
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ import type { RoamClient } from "../client.js";
3
+ import type { CallToolResult } from "../types.js";
4
+ export declare const DatalogQuerySchema: z.ZodObject<{
5
+ query: z.ZodString;
6
+ inputs: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ query: string;
9
+ inputs?: unknown[] | undefined;
10
+ }, {
11
+ query: string;
12
+ inputs?: unknown[] | undefined;
13
+ }>;
14
+ export type DatalogQueryParams = z.infer<typeof DatalogQuerySchema>;
15
+ export declare function datalogQuery(client: RoamClient, params: DatalogQueryParams): Promise<CallToolResult>;
16
+ //# sourceMappingURL=datalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datalog.d.ts","sourceRoot":"","sources":["../../src/operations/datalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,eAAO,MAAM,kBAAkB;;;;;;;;;EAQ7B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,wBAAsB,YAAY,CAChC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,cAAc,CAAC,CAIzB"}
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ import { textResult } from "../types.js";
3
+ export const DatalogQuerySchema = z.object({
4
+ query: z
5
+ .string()
6
+ .describe("Datalog query string (e.g., '[:find ?title :where [?e :node/title ?title]]')"),
7
+ inputs: z
8
+ .array(z.unknown())
9
+ .optional()
10
+ .describe("Input parameters for the query, corresponding to :in clause bindings after $"),
11
+ });
12
+ export async function datalogQuery(client, params) {
13
+ const args = params.inputs ? [params.query, ...params.inputs] : [params.query];
14
+ const response = await client.call("q", args);
15
+ return textResult(response.result ?? []);
16
+ }
@@ -16,14 +16,14 @@ export declare const FileUploadSchema: z.ZodObject<{
16
16
  filename: z.ZodOptional<z.ZodString>;
17
17
  }, "strip", z.ZodTypeAny, {
18
18
  url?: string | undefined;
19
- filePath?: string | undefined;
20
19
  base64?: string | undefined;
20
+ filePath?: string | undefined;
21
21
  mimetype?: string | undefined;
22
22
  filename?: string | undefined;
23
23
  }, {
24
24
  url?: string | undefined;
25
- filePath?: string | undefined;
26
25
  base64?: string | undefined;
26
+ filePath?: string | undefined;
27
27
  mimetype?: string | undefined;
28
28
  filename?: string | undefined;
29
29
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/operations/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;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AAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AA+GhE,wBAAsB,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAkBhG;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,cAAc,CAAC,CAiDzB;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,cAAc,CAAC,CAGzB"}
@@ -7,11 +7,23 @@ export const FileGetSchema = z.object({
7
7
  url: z.string().describe("Firebase storage URL of the file"),
8
8
  });
9
9
  export const FileUploadSchema = z.object({
10
- filePath: z.string().optional().describe("Local file path (preferred) - server reads the file directly"),
10
+ filePath: z
11
+ .string()
12
+ .optional()
13
+ .describe("Local file path (preferred) - server reads the file directly"),
11
14
  url: z.string().optional().describe("Remote URL to fetch the file from"),
12
- base64: z.string().optional().describe("Base64-encoded file data (fallback for sandboxed clients)"),
13
- mimetype: z.string().optional().describe("MIME type (e.g., image/png, image/jpeg) - auto-detected if not provided"),
14
- filename: z.string().optional().describe("Original filename for reference - derived from path/url if not provided"),
15
+ base64: z
16
+ .string()
17
+ .optional()
18
+ .describe("Base64-encoded file data (fallback for sandboxed clients)"),
19
+ mimetype: z
20
+ .string()
21
+ .optional()
22
+ .describe("MIME type (e.g., image/png, image/jpeg) - auto-detected if not provided"),
23
+ filename: z
24
+ .string()
25
+ .optional()
26
+ .describe("Original filename for reference - derived from path/url if not provided"),
15
27
  });
16
28
  export const FileDeleteSchema = z.object({
17
29
  url: z.string().describe("Firebase storage URL of the file to delete"),
@@ -102,7 +114,8 @@ async function fetchRemoteFile(url) {
102
114
  // Try Content-Type header first, then extension, then magic bytes
103
115
  let mimetype = response.headers.get("content-type")?.split(";")[0];
104
116
  if (!mimetype || mimetype === "application/octet-stream") {
105
- mimetype = detectMimeTypeFromExtension(urlPath) || detectMimeTypeFromBase64(base64) || undefined;
117
+ mimetype =
118
+ detectMimeTypeFromExtension(urlPath) || detectMimeTypeFromBase64(base64) || undefined;
106
119
  }
107
120
  if (!mimetype) {
108
121
  throw new Error(`Could not detect MIME type for URL: ${url}`);
@@ -1 +1 @@
1
- {"version":3,"file":"graphs.d.ts","sourceRoot":"","sources":["../../src/operations/graphs.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAsBlD,eAAO,MAAM,gBAAgB,gDAAe,CAAC;AAE7C,eAAO,MAAM,mBAAmB;;;;;;;;;EAoB9B,CAAC;AAMH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAMtE;;GAEG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC,CAmB1D;AAqDD;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,cAAc,CAAC,CAiKzB"}
1
+ {"version":3,"file":"graphs.d.ts","sourceRoot":"","sources":["../../src/operations/graphs.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAgBlD,eAAO,MAAM,gBAAgB,gDAAe,CAAC;AAE7C,eAAO,MAAM,mBAAmB;;;;;;;;;EAkB9B,CAAC;AAMH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAMtE;;GAEG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC,CAqB1D;AAkDD;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC,CA0JtF"}
@@ -3,7 +3,7 @@
3
3
  import { z } from "zod";
4
4
  import { textResult, RoamError, ErrorCodes } from "../types.js";
5
5
  import { getConfiguredGraphs, getConfiguredGraphsSafe, getPort, saveGraphToConfig, } from "../graph-resolver.js";
6
- import { fetchAvailableGraphs, requestToken, sleep, openRoamApp, slugify, } from "../roam-api.js";
6
+ import { fetchAvailableGraphs, requestToken, sleep, openRoamApp, slugify } from "../roam-api.js";
7
7
  // ============================================================================
8
8
  // Schemas
9
9
  // ============================================================================
@@ -78,8 +78,7 @@ async function fetchAvailableGraphsWithRetry(port) {
78
78
  }
79
79
  catch (error) {
80
80
  const err = error;
81
- const isConnectionError = err.cause?.code === "ECONNREFUSED" ||
82
- err.message?.includes("fetch failed");
81
+ const isConnectionError = err.cause?.code === "ECONNREFUSED" || err.message?.includes("fetch failed");
83
82
  if (!isConnectionError) {
84
83
  throw error;
85
84
  }
@@ -7,21 +7,21 @@ export declare const OpenMainWindowSchema: z.ZodObject<{
7
7
  uid: z.ZodOptional<z.ZodString>;
8
8
  title: z.ZodOptional<z.ZodString>;
9
9
  }, "strip", z.ZodTypeAny, {
10
- uid?: string | undefined;
11
10
  title?: string | undefined;
12
- }, {
13
11
  uid?: string | undefined;
12
+ }, {
14
13
  title?: string | undefined;
14
+ uid?: string | undefined;
15
15
  }>;
16
16
  export declare const OpenSidebarSchema: z.ZodObject<{
17
17
  uid: z.ZodString;
18
18
  type: z.ZodOptional<z.ZodEnum<["block", "outline", "mentions"]>>;
19
19
  }, "strip", z.ZodTypeAny, {
20
20
  uid: string;
21
- type?: "block" | "outline" | "mentions" | undefined;
21
+ type?: "mentions" | "block" | "outline" | undefined;
22
22
  }, {
23
23
  uid: string;
24
- type?: "block" | "outline" | "mentions" | undefined;
24
+ type?: "mentions" | "block" | "outline" | undefined;
25
25
  }>;
26
26
  export type OpenMainWindowParams = z.infer<typeof OpenMainWindowSchema>;
27
27
  export type OpenSidebarParams = z.infer<typeof OpenSidebarSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/operations/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAkE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlH,eAAO,MAAM,oBAAoB,gDAAe,CAAC;AAEjD,eAAO,MAAM,kBAAkB,gDAAe,CAAC;AAE/C,eAAO,MAAM,oBAAoB;;;;;;;;;EAG/B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;EAG5B,CAAC;AAGH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACxE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,wBAAsB,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,CAShF;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,CAS9E;AAED,wBAAsB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,CAQ9G;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAUxG"}
1
+ {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/operations/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAKV,cAAc,EACf,MAAM,aAAa,CAAC;AAIrB,eAAO,MAAM,oBAAoB,gDAAe,CAAC;AAEjD,eAAO,MAAM,kBAAkB,gDAAe,CAAC;AAE/C,eAAO,MAAM,oBAAoB;;;;;;;;;EAG/B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;EAM5B,CAAC;AAGH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACxE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,wBAAsB,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,CAShF;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,CAS9E;AAED,wBAAsB,cAAc,CAClC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,cAAc,CAAC,CAQzB;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,cAAc,CAAC,CAUzB"}
@@ -9,7 +9,10 @@ export const OpenMainWindowSchema = z.object({
9
9
  });
10
10
  export const OpenSidebarSchema = z.object({
11
11
  uid: z.string().describe("UID of page or block"),
12
- type: z.enum(["block", "outline", "mentions"]).optional().describe("View type (default: outline)"),
12
+ type: z
13
+ .enum(["block", "outline", "mentions"])
14
+ .optional()
15
+ .describe("View type (default: outline)"),
13
16
  });
14
17
  export async function getOpenWindows(client) {
15
18
  const [mainResponse, sidebarResponse] = await Promise.all([
@@ -5,26 +5,29 @@ export declare const CreatePageSchema: z.ZodObject<{
5
5
  title: z.ZodString;
6
6
  markdown: z.ZodOptional<z.ZodString>;
7
7
  uid: z.ZodOptional<z.ZodString>;
8
+ childrenViewType: z.ZodOptional<z.ZodEnum<["document", "bullet", "numbered"]>>;
8
9
  }, "strip", z.ZodTypeAny, {
9
10
  title: string;
10
- uid?: string | undefined;
11
11
  markdown?: string | undefined;
12
+ uid?: string | undefined;
13
+ childrenViewType?: "bullet" | "numbered" | "document" | undefined;
12
14
  }, {
13
15
  title: string;
14
- uid?: string | undefined;
15
16
  markdown?: string | undefined;
17
+ uid?: string | undefined;
18
+ childrenViewType?: "bullet" | "numbered" | "document" | undefined;
16
19
  }>;
17
20
  export declare const GetPageSchema: z.ZodObject<{
18
21
  title: z.ZodOptional<z.ZodString>;
19
22
  uid: z.ZodOptional<z.ZodString>;
20
23
  maxDepth: z.ZodOptional<z.ZodNumber>;
21
24
  }, "strip", z.ZodTypeAny, {
22
- uid?: string | undefined;
23
25
  title?: string | undefined;
26
+ uid?: string | undefined;
24
27
  maxDepth?: number | undefined;
25
28
  }, {
26
- uid?: string | undefined;
27
29
  title?: string | undefined;
30
+ uid?: string | undefined;
28
31
  maxDepth?: number | undefined;
29
32
  }>;
30
33
  export declare const DeletePageSchema: z.ZodObject<{
@@ -42,12 +45,12 @@ export declare const UpdatePageSchema: z.ZodObject<{
42
45
  }, "strip", z.ZodTypeAny, {
43
46
  uid: string;
44
47
  title?: string | undefined;
45
- childrenViewType?: "document" | "bullet" | "numbered" | undefined;
48
+ childrenViewType?: "bullet" | "numbered" | "document" | undefined;
46
49
  mergePages?: boolean | undefined;
47
50
  }, {
48
51
  uid: string;
49
52
  title?: string | undefined;
50
- childrenViewType?: "document" | "bullet" | "numbered" | undefined;
53
+ childrenViewType?: "bullet" | "numbered" | "document" | undefined;
51
54
  mergePages?: boolean | undefined;
52
55
  }>;
53
56
  export declare const GetGuidelinesSchema: z.ZodObject<{}, "strip",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AC,cAAc,CAAC,CAGzB;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,cAAc,CAAC,CAUzB;AAED,wBAAsB,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,CA0B/E"}
@@ -4,12 +4,22 @@ import { textResult } from "../types.js";
4
4
  export const CreatePageSchema = z.object({
5
5
  title: z.string().describe("Page title"),
6
6
  markdown: z.string().optional().describe("Markdown content for the page"),
7
- uid: z.string().optional(),
7
+ uid: z
8
+ .string()
9
+ .optional()
10
+ .describe("Custom UID to assign to the new page. Omit to let Roam auto-generate one (recommended)"),
11
+ childrenViewType: z
12
+ .enum(["document", "bullet", "numbered"])
13
+ .optional()
14
+ .describe("How children are displayed (document, bullet, or numbered)"),
8
15
  });
9
16
  export const GetPageSchema = z.object({
10
17
  title: z.string().optional().describe("Page title (alternative to uid)"),
11
18
  uid: z.string().optional().describe("Page UID"),
12
- maxDepth: z.coerce.number().optional().describe("Max depth of children to include in markdown (omit for full tree)"),
19
+ maxDepth: z.coerce
20
+ .number()
21
+ .optional()
22
+ .describe("Max depth of children to include in markdown (omit for full tree)"),
13
23
  });
14
24
  export const DeletePageSchema = z.object({
15
25
  uid: z.string().describe("Page UID to delete"),
@@ -17,21 +27,31 @@ export const DeletePageSchema = z.object({
17
27
  export const UpdatePageSchema = z.object({
18
28
  uid: z.string().describe("Page UID"),
19
29
  title: z.string().optional().describe("New page title"),
20
- childrenViewType: z.enum(["document", "bullet", "numbered"]).optional().describe("How children are displayed (document, bullet, or numbered)"),
21
- mergePages: z.boolean().optional().describe("If true, merge with existing page when renaming to a title that already exists (default: false)"),
30
+ childrenViewType: z
31
+ .enum(["document", "bullet", "numbered"])
32
+ .optional()
33
+ .describe("How children are displayed (document, bullet, or numbered)"),
34
+ mergePages: z
35
+ .boolean()
36
+ .optional()
37
+ .describe("If true, merge with existing page when renaming to a title that already exists (default: false)"),
22
38
  });
23
39
  export const GetGuidelinesSchema = z.object({});
24
40
  export async function createPage(client, params) {
41
+ const page = { title: params.title };
42
+ if (params.uid !== undefined)
43
+ page.uid = params.uid;
44
+ if (params.childrenViewType !== undefined)
45
+ page["children-view-type"] = params.childrenViewType;
25
46
  const response = await client.call("data.page.fromMarkdown", [
26
- {
27
- page: { title: params.title, uid: params.uid },
28
- "markdown-string": params.markdown,
29
- },
47
+ { page, "markdown-string": params.markdown },
30
48
  ]);
31
49
  return textResult(response.result ?? { uid: "" });
32
50
  }
33
51
  export async function getPage(client, params) {
34
- const apiParams = params.uid ? { uid: params.uid } : { title: params.title };
52
+ const apiParams = params.uid
53
+ ? { uid: params.uid }
54
+ : { title: params.title };
35
55
  if (params.maxDepth !== undefined)
36
56
  apiParams.maxDepth = params.maxDepth;
37
57
  const response = await client.call("data.ai.getPage", [apiParams]);
@@ -55,7 +75,11 @@ export async function updatePage(client, params) {
55
75
  }
56
76
  export async function getGuidelines(client) {
57
77
  const response = await client.call("data.ai.getGraphGuidelines", []);
58
- const result = response.result ?? { guidelines: null, starredPages: [], todaysDailyNotePage: null };
78
+ const result = response.result ?? {
79
+ guidelines: null,
80
+ starredPages: [],
81
+ todaysDailyNotePage: null,
82
+ };
59
83
  const dnpTitle = result.todaysDailyNotePage;
60
84
  const nextSteps = dnpTitle
61
85
  ? `Start by reading today's daily note page ("${dnpTitle}") with get_page — this is the user's primary workspace for the day. If you need more context, call search with an empty query for recently edited and viewed content. Skip these orientation steps only when the user has already given you a specific task to execute (e.g. "create a page called X").`
@@ -13,21 +13,21 @@ export declare const QuerySchema: z.ZodObject<{
13
13
  }, "strip", z.ZodTypeAny, {
14
14
  sort?: "created-date" | "edited-date" | "daily-note-date" | undefined;
15
15
  uid?: string | undefined;
16
- query?: string | undefined;
17
- sortOrder?: "asc" | "desc" | undefined;
18
- includePath?: boolean | undefined;
16
+ maxDepth?: number | undefined;
19
17
  offset?: number | undefined;
20
18
  limit?: number | undefined;
21
- maxDepth?: number | undefined;
19
+ sortOrder?: "asc" | "desc" | undefined;
20
+ includePath?: boolean | undefined;
21
+ query?: string | undefined;
22
22
  }, {
23
23
  sort?: "created-date" | "edited-date" | "daily-note-date" | undefined;
24
24
  uid?: string | undefined;
25
- query?: string | undefined;
26
- sortOrder?: "asc" | "desc" | undefined;
27
- includePath?: boolean | undefined;
25
+ maxDepth?: number | undefined;
28
26
  offset?: number | undefined;
29
27
  limit?: number | undefined;
30
- maxDepth?: number | undefined;
28
+ sortOrder?: "asc" | "desc" | undefined;
29
+ includePath?: boolean | undefined;
30
+ query?: string | undefined;
31
31
  }>;
32
32
  export type QueryParams = z.infer<typeof QuerySchema>;
33
33
  export declare function query(client: RoamClient, params: QueryParams): Promise<CallToolResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/operations/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,aAAa,CAAC;AAKjE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;EAStB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,wBAAsB,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CA2B5F"}
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/operations/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,aAAa,CAAC;AAKjE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BtB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,wBAAsB,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CA2B5F"}
@@ -3,14 +3,32 @@ import { textResult } from "../types.js";
3
3
  // Schema for executing Roam queries ({{query: }} or {{[[query]]: }} blocks, NOT Datalog)
4
4
  // Supports two modes: UID mode (execute existing query block) or Query mode (raw query string)
5
5
  export const QuerySchema = z.object({
6
- uid: z.string().optional().describe("UID of a block containing {{query: ...}} or {{[[query]]: ...}} - uses the block's saved display settings and filters"),
7
- query: z.string().optional().describe("Raw Roam query string (e.g., \"{and: [[TODO]] {not: [[DONE]]}}\") - NOT Datalog - results are flat list, no user filters applied"),
8
- sort: z.enum(["created-date", "edited-date", "daily-note-date"]).optional().describe("Sort order (only for query mode, default: created-date)"),
9
- sortOrder: z.enum(["asc", "desc"]).optional().describe("Sort direction (only for query mode, default: desc)"),
10
- includePath: z.boolean().optional().describe("Include breadcrumb path in results (only for query mode, default: true)"),
6
+ uid: z
7
+ .string()
8
+ .optional()
9
+ .describe("UID of a block containing {{query: ...}} or {{[[query]]: ...}} - uses the block's saved display settings and filters"),
10
+ query: z
11
+ .string()
12
+ .optional()
13
+ .describe('Raw Roam query string (e.g., "{and: [[TODO]] {not: [[DONE]]}}") - NOT Datalog - results are flat list, no user filters applied'),
14
+ sort: z
15
+ .enum(["created-date", "edited-date", "daily-note-date"])
16
+ .optional()
17
+ .describe("Sort order (only for query mode, default: created-date)"),
18
+ sortOrder: z
19
+ .enum(["asc", "desc"])
20
+ .optional()
21
+ .describe("Sort direction (only for query mode, default: desc)"),
22
+ includePath: z
23
+ .boolean()
24
+ .optional()
25
+ .describe("Include breadcrumb path in results (only for query mode, default: true)"),
11
26
  offset: z.coerce.number().optional().describe("Skip first N results (default: 0)"),
12
27
  limit: z.coerce.number().optional().describe("Max results to return (default: 20)"),
13
- maxDepth: z.coerce.number().optional().describe("Max depth of children to include in markdown (default: 1)"),
28
+ maxDepth: z.coerce
29
+ .number()
30
+ .optional()
31
+ .describe("Max depth of children to include in markdown (default: 1)"),
14
32
  });
15
33
  export async function query(client, params) {
16
34
  // Validate: exactly one of uid or query must be provided
@@ -10,17 +10,17 @@ export declare const SearchSchema: z.ZodObject<{
10
10
  maxDepth: z.ZodOptional<z.ZodNumber>;
11
11
  }, "strip", z.ZodTypeAny, {
12
12
  query: string;
13
- includePath?: boolean | undefined;
13
+ maxDepth?: number | undefined;
14
14
  offset?: number | undefined;
15
15
  limit?: number | undefined;
16
- maxDepth?: number | undefined;
16
+ includePath?: boolean | undefined;
17
17
  scope?: "pages" | "blocks" | "all" | undefined;
18
18
  }, {
19
19
  query: string;
20
- includePath?: boolean | undefined;
20
+ maxDepth?: number | undefined;
21
21
  offset?: number | undefined;
22
22
  limit?: number | undefined;
23
- maxDepth?: number | undefined;
23
+ includePath?: boolean | undefined;
24
24
  scope?: "pages" | "blocks" | "all" | undefined;
25
25
  }>;
26
26
  export declare const SearchTemplatesSchema: z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/operations/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAsE,cAAc,EAAE,MAAM,aAAa,CAAC;AAItH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;EAOvB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;EAEhC,CAAC;AAGH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACxD,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,wBAAsB,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAY9F;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,cAAc,CAAC,CAKzB"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/operations/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAIV,cAAc,EACf,MAAM,aAAa,CAAC;AAIrB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;EAoBvB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;EAOhC,CAAC;AAGH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACxD,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,wBAAsB,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAc9F;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,cAAc,CAAC,CAKzB"}
@@ -2,15 +2,29 @@ import { z } from "zod";
2
2
  import { textResult } from "../types.js";
3
3
  // Schemas
4
4
  export const SearchSchema = z.object({
5
- query: z.string().describe("Search query — use empty string to get recently edited and viewed content"),
6
- scope: z.enum(["pages", "blocks", "all"]).optional().describe("Search scope: 'pages' for page titles only, 'blocks' for block content only, 'all' for both (default: 'all')"),
5
+ query: z
6
+ .string()
7
+ .describe("Search query — use empty string to get recently edited and viewed content"),
8
+ scope: z
9
+ .enum(["pages", "blocks", "all"])
10
+ .optional()
11
+ .describe("Search scope: 'pages' for page titles only, 'blocks' for block content only, 'all' for both (default: 'all')"),
7
12
  offset: z.coerce.number().optional().describe("Skip first N results (default: 0)"),
8
13
  limit: z.coerce.number().optional().describe("Max results (default: 20)"),
9
- includePath: z.boolean().optional().describe("Include breadcrumb path to each result (default: true)"),
10
- maxDepth: z.coerce.number().optional().describe("Max depth of children to include in markdown (default: 0)"),
14
+ includePath: z
15
+ .boolean()
16
+ .optional()
17
+ .describe("Include breadcrumb path to each result (default: true)"),
18
+ maxDepth: z.coerce
19
+ .number()
20
+ .optional()
21
+ .describe("Max depth of children to include in markdown (default: 0)"),
11
22
  });
12
23
  export const SearchTemplatesSchema = z.object({
13
- query: z.string().optional().describe("Keywords to filter templates by name (case-insensitive). Try relevant keywords first before listing all."),
24
+ query: z
25
+ .string()
26
+ .optional()
27
+ .describe("Keywords to filter templates by name (case-insensitive). Try relevant keywords first before listing all."),
14
28
  });
15
29
  export async function search(client, params) {
16
30
  const apiParams = {
@@ -22,7 +36,9 @@ export async function search(client, params) {
22
36
  };
23
37
  if (params.maxDepth !== undefined)
24
38
  apiParams.maxDepth = params.maxDepth;
25
- const response = await client.call("data.ai.search", [apiParams]);
39
+ const response = await client.call("data.ai.search", [
40
+ apiParams,
41
+ ]);
26
42
  return textResult(response.result ?? { total: 0, results: [] });
27
43
  }
28
44
  export async function searchTemplates(client, params) {
@@ -1 +1 @@
1
- {"version":3,"file":"roam-api.d.ts","sourceRoot":"","sources":["../src/roam-api.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAM5C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAC1B,KA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AC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IACnC,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACvE,IAAI,EAAE,QAAQ,CAAC;CAChB;AAGD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IACnC,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACnD,IAAI,EAAE,YAAY,CAAC;CACpB;AAED,MAAM,MAAM,cAAc,GAAG,oBAAoB,GAAG,wBAAwB,CAAC;AAsN7E,eAAO,MAAM,KAAK,EAAE,cAAc,EAA+C,CAAC;AAElF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAEjE;AAuFD,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,cAAc,CAAC,CAyIzB"}
package/dist/tools.js CHANGED
@@ -4,14 +4,18 @@ import { RoamClient } from "./client.js";
4
4
  import { resolveGraph, getPort, updateGraphTokenStatus } from "./graph-resolver.js";
5
5
  import { CreatePageSchema, GetPageSchema, DeletePageSchema, UpdatePageSchema, GetGuidelinesSchema, createPage, getPage, deletePage, updatePage, getGuidelines, } from "./operations/pages.js";
6
6
  import { CreateBlockSchema, GetBlockSchema, UpdateBlockSchema, DeleteBlockSchema, MoveBlockSchema, GetBacklinksSchema, AddCommentSchema, GetCommentsSchema, createBlock, getBlock, updateBlock, deleteBlock, moveBlock, getBacklinks, addComment, getComments, } from "./operations/blocks.js";
7
- import { SearchSchema, SearchTemplatesSchema, search, searchTemplates } from "./operations/search.js";
7
+ import { SearchSchema, SearchTemplatesSchema, search, searchTemplates, } from "./operations/search.js";
8
8
  import { QuerySchema, query } from "./operations/query.js";
9
+ import { DatalogQuerySchema, datalogQuery } from "./operations/datalog.js";
9
10
  import { GetOpenWindowsSchema, GetSelectionSchema, OpenMainWindowSchema, OpenSidebarSchema, getOpenWindows, getSelection, openMainWindow, openSidebar, } from "./operations/navigation.js";
10
- import { FileGetSchema, FileUploadSchema, FileDeleteSchema, getFile, uploadFile, deleteFile } from "./operations/files.js";
11
- import { ListGraphsSchema, SetupNewGraphSchema, listGraphs, setupNewGraph } from "./operations/graphs.js";
11
+ import { FileGetSchema, FileUploadSchema, FileDeleteSchema, getFile, uploadFile, deleteFile, } from "./operations/files.js";
12
+ import { ListGraphsSchema, SetupNewGraphSchema, listGraphs, setupNewGraph, } from "./operations/graphs.js";
12
13
  // Common schema for graph parameter (used by most tools)
13
14
  const GraphSchema = z.object({
14
- graph: z.string().optional().describe("Graph nickname or name (optional - auto-selects if only one graph is configured)"),
15
+ graph: z
16
+ .string()
17
+ .optional()
18
+ .describe("Graph nickname or name (optional - auto-selects if only one graph is configured)"),
15
19
  });
16
20
  // Helper to extend any schema with graph parameter
17
21
  function withGraph(schema) {
@@ -48,32 +52,42 @@ const GUIDELINES_NOTE = "\n\nNote: Call get_graph_guidelines first when starting
48
52
  const contentTools = [
49
53
  defineTool("get_graph_guidelines", "IMPORTANT: Call this tool first when starting to work with a graph, before performing any other operations. Returns user-defined instructions and preferences for AI agents. The user may have specified naming conventions, preferred structures, or constraints that should guide your behavior. After receiving the response, follow the nextSteps field — it contains orientation actions you should take before proceeding.", GetGuidelinesSchema, getGuidelines),
50
54
  defineTool("create_page", "Create a new page in Roam, optionally with markdown content." + GUIDELINES_NOTE, CreatePageSchema, createPage),
51
- defineTool("create_block", "Create blocks from markdown content. Target by parentUid, pageTitle, or dailyNotePage (page created if needed). Use nestUnder to insert under a specific child block. Supports nested bulleted lists via markdown indentation." + GUIDELINES_NOTE, CreateBlockSchema, createBlock),
55
+ defineTool("create_block", "Create blocks from markdown content. Target by parentUid, pageTitle, or dailyNotePage (page created if needed). Use nestUnder to insert under a specific child block. Supports nested bulleted lists via markdown indentation." +
56
+ GUIDELINES_NOTE, CreateBlockSchema, createBlock),
52
57
  defineTool("update_block", "Update an existing block's content or properties." + GUIDELINES_NOTE, UpdateBlockSchema, updateBlock),
53
58
  defineTool("delete_block", "Delete a block and all its children." + GUIDELINES_NOTE, DeleteBlockSchema, deleteBlock),
54
59
  defineTool("move_block", "Move a block to a new location." + GUIDELINES_NOTE, MoveBlockSchema, moveBlock),
55
- defineTool("add_comment", "Add a comment to a block (comment thread, NOT a child block). Prefer `comment` for simple text; use `commentMarkdown` for structured content. Same-day calls on the same block append to your existing comment." + GUIDELINES_NOTE, AddCommentSchema, addComment),
56
- defineTool("get_comments", "Get comments on a block with author, timestamps, and edit info. If singleEditableUid is set, the comment can be edited with update_block. Only works for blocks, not pages." + GUIDELINES_NOTE, GetCommentsSchema, getComments),
60
+ defineTool("add_comment", "Add a comment to a block (comment thread, NOT a child block). Prefer `comment` for simple text; use `commentMarkdown` for structured content. Same-day calls on the same block append to your existing comment." +
61
+ GUIDELINES_NOTE, AddCommentSchema, addComment),
62
+ defineTool("get_comments", "Get comments on a block with author, timestamps, and edit info. If singleEditableUid is set, the comment can be edited with update_block. Only works for blocks, not pages." +
63
+ GUIDELINES_NOTE, GetCommentsSchema, getComments),
57
64
  defineTool("delete_page", "Delete a page and all its contents." + GUIDELINES_NOTE, DeletePageSchema, deletePage),
58
- defineTool("update_page", "Update a page's title or children view type. Set mergePages to true if renaming to a title that already exists." + GUIDELINES_NOTE, UpdatePageSchema, updatePage),
59
- defineTool("search", "Search for pages and blocks by text. Returns paginated results with markdown content and optional breadcrumb paths. Call with an empty query to get recently edited and viewed content — useful for understanding what the user is currently working on." + GUIDELINES_NOTE, SearchSchema, search),
60
- defineTool("search_templates", "Search Roam templates by name. When the user mentions 'my X template' or 'the X template', use this tool to find it. Templates are user-created reusable content blocks tagged with [[roam/templates]]. Returns template name, uid, and content as markdown." + GUIDELINES_NOTE, SearchTemplatesSchema, searchTemplates),
61
- defineTool("roam_query", 'Execute a Roam query ({{query: }} or {{[[query]]: }} blocks, NOT Datalog). Two modes: (1) UID mode - pass a block UID containing a query component to run it with saved settings/filters; (2) Query mode - pass a raw query string like "{and: [[TODO]] {not: [[DONE]]}}". Returns paginated results with markdown content.' + GUIDELINES_NOTE, QuerySchema, query),
62
- defineTool("get_page", "Get a page's content as markdown. Returns content with <roam> metadata tags containing UIDs - use these for follow-up operations but strip them when showing content to the user. Show remaining content verbatim, never paraphrase. Use maxDepth for large pages." + GUIDELINES_NOTE, GetPageSchema, getPage),
63
- defineTool("get_block", "Get a block's content as markdown. Returns content with <roam> metadata tags containing UIDs - use these for follow-up operations but strip them when showing content to the user. Show remaining content verbatim, never paraphrase. Use maxDepth for large blocks." + GUIDELINES_NOTE, GetBlockSchema, getBlock),
64
- defineTool("get_backlinks", "Get paginated backlinks (linked references) for a page or block, formatted as markdown. Returns total count and results with optional breadcrumb paths." + GUIDELINES_NOTE, GetBacklinksSchema, getBacklinks),
65
+ defineTool("update_page", "Update a page's title or children view type. Set mergePages to true if renaming to a title that already exists." +
66
+ GUIDELINES_NOTE, UpdatePageSchema, updatePage),
67
+ defineTool("search", "Search for pages and blocks by text. Returns paginated results with markdown content and optional breadcrumb paths. Call with an empty query to get recently edited and viewed content useful for understanding what the user is currently working on." +
68
+ GUIDELINES_NOTE, SearchSchema, search),
69
+ defineTool("search_templates", "Search Roam templates by name. When the user mentions 'my X template' or 'the X template', use this tool to find it. Templates are user-created reusable content blocks tagged with [[roam/templates]]. Returns template name, uid, and content as markdown." +
70
+ GUIDELINES_NOTE, SearchTemplatesSchema, searchTemplates),
71
+ defineTool("roam_query", 'Execute a Roam query ({{query: }} or {{[[query]]: }} blocks, NOT Datalog). Two modes: (1) UID mode - pass a block UID containing a query component to run it with saved settings/filters; (2) Query mode - pass a raw query string like "{and: [[TODO]] {not: [[DONE]]}}". Returns paginated results with markdown content.' +
72
+ GUIDELINES_NOTE, QuerySchema, query),
73
+ defineTool("datalog_query", "Execute a datomic-style datalog query against the graph's datascript database. Supported clauses: :find, :where, :in, and :timeout (ms). Inputs are positional parameters bound to :in variables after $. Write specific :where clauses to keep results bounded." +
74
+ GUIDELINES_NOTE, DatalogQuerySchema, datalogQuery),
75
+ defineTool("get_page", "Get a page's content as markdown. Returns content with <roam> metadata tags containing UIDs - use these for follow-up operations but strip them when showing content to the user. Show remaining content verbatim, never paraphrase. Use maxDepth for large pages." +
76
+ GUIDELINES_NOTE, GetPageSchema, getPage),
77
+ defineTool("get_block", "Get a block's content as markdown. Returns content with <roam> metadata tags containing UIDs - use these for follow-up operations but strip them when showing content to the user. Show remaining content verbatim, never paraphrase. Use maxDepth for large blocks." +
78
+ GUIDELINES_NOTE, GetBlockSchema, getBlock),
79
+ defineTool("get_backlinks", "Get paginated backlinks (linked references) for a page or block, formatted as markdown. Returns total count and results with optional breadcrumb paths." +
80
+ GUIDELINES_NOTE, GetBacklinksSchema, getBacklinks),
65
81
  defineTool("get_open_windows", "Get the current view in the main window and all open sidebar windows." + GUIDELINES_NOTE, GetOpenWindowsSchema, getOpenWindows),
66
82
  defineTool("get_selection", "Get the currently focused block and any multi-selected blocks." + GUIDELINES_NOTE, GetSelectionSchema, getSelection),
67
83
  defineTool("open_main_window", "Navigate to a page or block in the main window." + GUIDELINES_NOTE, OpenMainWindowSchema, openMainWindow),
68
84
  defineTool("open_sidebar", "Open a page or block in the right sidebar." + GUIDELINES_NOTE, OpenSidebarSchema, openSidebar),
69
85
  defineTool("file_get", "Fetch a file hosted on Roam (handles decryption for encrypted graphs)." + GUIDELINES_NOTE, FileGetSchema, getFile),
70
- defineTool("file_upload", "Upload a file to Roam. Returns the Firebase storage URL. Usually you'll want to create a new block with the file as markdown: `![](url)`. Provide ONE of: filePath (preferred - local file, server reads directly), url (remote URL, server fetches), or base64 (raw data, fallback for sandboxed clients)." + GUIDELINES_NOTE, FileUploadSchema, uploadFile),
86
+ defineTool("file_upload", "Upload a file to Roam. Returns the Firebase storage URL. Usually you'll want to create a new block with the file as markdown: `![](url)`. Provide ONE of: filePath (preferred - local file, server reads directly), url (remote URL, server fetches), or base64 (raw data, fallback for sandboxed clients)." +
87
+ GUIDELINES_NOTE, FileUploadSchema, uploadFile),
71
88
  defineTool("file_delete", "Delete a file hosted on Roam." + GUIDELINES_NOTE, FileDeleteSchema, deleteFile),
72
89
  ];
73
- export const tools = [
74
- ...graphManagementTools,
75
- ...contentTools,
76
- ];
90
+ export const tools = [...graphManagementTools, ...contentTools];
77
91
  export function findTool(name) {
78
92
  return tools.find((t) => t.name === name);
79
93
  }
@@ -89,19 +103,13 @@ function prependGraphInfo(result, nickname) {
89
103
  if (first.type === "text") {
90
104
  return {
91
105
  ...result,
92
- content: [
93
- { ...first, text: `${prefix}\n\n${first.text}` },
94
- ...content.slice(1),
95
- ],
106
+ content: [{ ...first, text: `${prefix}\n\n${first.text}` }, ...content.slice(1)],
96
107
  };
97
108
  }
98
109
  // For image or other content types, prepend a text block
99
110
  return {
100
111
  ...result,
101
- content: [
102
- { type: "text", text: prefix },
103
- ...content,
104
- ],
112
+ content: [{ type: "text", text: prefix }, ...content],
105
113
  };
106
114
  }
107
115
  /**
@@ -208,9 +216,13 @@ export async function routeToolCall(toolName, args) {
208
216
  if (tokenInfoResult.status === "revoked") {
209
217
  if (resolvedGraph.lastKnownTokenStatus !== "revoked") {
210
218
  try {
211
- await updateGraphTokenStatus(resolvedGraph.nickname, { lastKnownTokenStatus: "revoked" });
219
+ await updateGraphTokenStatus(resolvedGraph.nickname, {
220
+ lastKnownTokenStatus: "revoked",
221
+ });
222
+ }
223
+ catch {
224
+ // best-effort status update
212
225
  }
213
- catch { }
214
226
  }
215
227
  const baseResult = actionSettled.status === "fulfilled"
216
228
  ? actionSettled.value
@@ -241,7 +253,9 @@ export async function routeToolCall(toolName, args) {
241
253
  lastKnownTokenStatus: "active",
242
254
  });
243
255
  }
244
- catch { }
256
+ catch {
257
+ // best-effort status update
258
+ }
245
259
  }
246
260
  if (!result.isError) {
247
261
  const enriched = enrichResultWithTokenInfo(result, info);
@@ -254,7 +268,9 @@ export async function routeToolCall(toolName, args) {
254
268
  try {
255
269
  await updateGraphTokenStatus(resolvedGraph.nickname, { lastKnownTokenStatus: "active" });
256
270
  }
257
- catch { }
271
+ catch {
272
+ // best-effort status update
273
+ }
258
274
  }
259
275
  if (!result.isError) {
260
276
  return prependGraphInfo(result, resolvedGraph.nickname);
package/dist/types.d.ts CHANGED
@@ -14,8 +14,8 @@ export declare const GraphConfigSchema: z.ZodObject<{
14
14
  accessLevel: z.ZodOptional<z.ZodEnum<["read-only", "read-append", "full"]>>;
15
15
  lastKnownTokenStatus: z.ZodOptional<z.ZodEnum<["active", "revoked"]>>;
16
16
  }, "strip", z.ZodTypeAny, {
17
- name: string;
18
17
  type: "hosted" | "offline";
18
+ name: string;
19
19
  token: string;
20
20
  nickname: string;
21
21
  accessLevel?: "read-only" | "read-append" | "full" | undefined;
@@ -39,8 +39,8 @@ export declare const RoamMcpConfigSchema: z.ZodObject<{
39
39
  accessLevel: z.ZodOptional<z.ZodEnum<["read-only", "read-append", "full"]>>;
40
40
  lastKnownTokenStatus: z.ZodOptional<z.ZodEnum<["active", "revoked"]>>;
41
41
  }, "strip", z.ZodTypeAny, {
42
- name: string;
43
42
  type: "hosted" | "offline";
43
+ name: string;
44
44
  token: string;
45
45
  nickname: string;
46
46
  accessLevel?: "read-only" | "read-append" | "full" | undefined;
@@ -55,8 +55,8 @@ export declare const RoamMcpConfigSchema: z.ZodObject<{
55
55
  }>, "many">;
56
56
  }, "strip", z.ZodTypeAny, {
57
57
  graphs: {
58
- name: string;
59
58
  type: "hosted" | "offline";
59
+ name: string;
60
60
  token: string;
61
61
  nickname: string;
62
62
  accessLevel?: "read-only" | "read-append" | "full" | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":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AAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAGD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAGD,MAAM,MAAM,eAAe,GACvB;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,iBAAiB,CAAA;CAAE,GAC7C;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GACrB;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC;AAG1B,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
package/dist/types.js CHANGED
@@ -16,14 +16,24 @@ export function errorResult(message) {
16
16
  // Graph names can only contain alphanumeric characters, hyphens, and underscores
17
17
  const GRAPH_NAME_PATTERN = /^[A-Za-z0-9_-]+$/;
18
18
  export const GraphConfigSchema = z.object({
19
- name: z.string().regex(GRAPH_NAME_PATTERN, "Graph name can only contain letters, numbers, hyphens, and underscores").describe("Actual graph name in Roam"),
19
+ name: z
20
+ .string()
21
+ .regex(GRAPH_NAME_PATTERN, "Graph name can only contain letters, numbers, hyphens, and underscores")
22
+ .describe("Actual graph name in Roam"),
20
23
  type: z.enum(["hosted", "offline"]).default("hosted").describe("Graph type"),
21
24
  token: z.string().startsWith("roam-graph-local-token-").describe("Local API token"),
22
- nickname: z.string()
25
+ nickname: z
26
+ .string()
23
27
  .regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, "Nickname must be lowercase letters, numbers, and hyphens")
24
28
  .describe("Short identifier for the graph (lowercase, hyphens, no spaces)"),
25
- accessLevel: z.enum(["read-only", "read-append", "full"]).optional().describe("Token access level"),
26
- lastKnownTokenStatus: z.enum(["active", "revoked"]).optional().describe("Token validity status from last sync with Roam"),
29
+ accessLevel: z
30
+ .enum(["read-only", "read-append", "full"])
31
+ .optional()
32
+ .describe("Token access level"),
33
+ lastKnownTokenStatus: z
34
+ .enum(["active", "revoked"])
35
+ .optional()
36
+ .describe("Token validity status from last sync with Roam"),
27
37
  });
28
38
  export const RoamMcpConfigSchema = z.object({
29
39
  version: z.number().int().positive().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roam-research/roam-tools-core",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Core library for Roam Research tools",
5
5
  "repository": {
6
6
  "type": "git",