@roam-research/roam-tools-core 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +23 -8
  2. package/dist/index.d.ts +3 -7
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +8 -8
  5. package/dist/operations/blocks.d.ts +9 -10
  6. package/dist/operations/blocks.d.ts.map +1 -1
  7. package/dist/operations/datalog.d.ts +2 -3
  8. package/dist/operations/datalog.d.ts.map +1 -1
  9. package/dist/operations/files.d.ts +4 -5
  10. package/dist/operations/files.d.ts.map +1 -1
  11. package/dist/operations/navigation.d.ts +5 -6
  12. package/dist/operations/navigation.d.ts.map +1 -1
  13. package/dist/operations/pages.d.ts +6 -7
  14. package/dist/operations/pages.d.ts.map +1 -1
  15. package/dist/operations/query.d.ts +2 -3
  16. package/dist/operations/query.d.ts.map +1 -1
  17. package/dist/operations/search.d.ts +3 -4
  18. package/dist/operations/search.d.ts.map +1 -1
  19. package/dist/tools.d.ts +37 -4
  20. package/dist/tools.d.ts.map +1 -1
  21. package/dist/tools.js +47 -52
  22. package/dist/types.d.ts +8 -7
  23. package/dist/types.d.ts.map +1 -1
  24. package/package.json +7 -10
  25. package/dist/client.d.ts +0 -34
  26. package/dist/client.d.ts.map +0 -1
  27. package/dist/client.js +0 -275
  28. package/dist/connect.d.ts +0 -10
  29. package/dist/connect.d.ts.map +0 -1
  30. package/dist/connect.js +0 -475
  31. package/dist/graph-resolver.d.ts +0 -54
  32. package/dist/graph-resolver.d.ts.map +0 -1
  33. package/dist/graph-resolver.js +0 -339
  34. package/dist/operations/graphs.d.ts +0 -26
  35. package/dist/operations/graphs.d.ts.map +0 -1
  36. package/dist/operations/graphs.js +0 -213
  37. package/dist/roam-api.d.ts +0 -32
  38. package/dist/roam-api.d.ts.map +0 -1
  39. package/dist/roam-api.js +0 -50
package/README.md CHANGED
@@ -1,17 +1,32 @@
1
1
  # @roam-research/roam-tools-core
2
2
 
3
- Shared core library for Roam Research tools. Provides the Roam API client, tool definitions, graph resolution, and operations.
3
+ Transport-agnostic core for Roam Research MCP and CLI tools. Provides the tool registry, schemas, operation functions, and dispatch — but no transport.
4
4
 
5
- > **This package is not meant to be used directly.** It is an internal dependency of [`@roam-research/roam-mcp`](https://www.npmjs.com/package/@roam-research/roam-mcp) (MCP server) and [`@roam-research/roam-cli`](https://www.npmjs.com/package/@roam-research/roam-cli) (CLI). If you want to connect an AI assistant to Roam, install `@roam-research/roam-mcp`. If you want a command-line interface, install `@roam-research/roam-cli`.
5
+ > **Most users don't want this package directly.** If you want to connect an AI assistant to Roam, install [`@roam-research/roam-mcp`](https://www.npmjs.com/package/@roam-research/roam-mcp). For the command line, install [`@roam-research/roam-cli`](https://www.npmjs.com/package/@roam-research/roam-cli). Both wrap the local Roam Desktop transport ([`@roam-research/roam-tools-local`](https://www.npmjs.com/package/@roam-research/roam-tools-local)) which depends on this package.
6
+
7
+ ## Who is this for?
8
+
9
+ This package is for **hosted MCP transports** that talk to Roam through a different backend (e.g., a WorkOS-authenticated proxy) and want to reuse the same tool registry, Zod schemas, and operation functions without dragging in the local Roam Desktop client or the `~/.roam-tools.json` config reader.
6
10
 
7
11
  ## What's in here
8
12
 
9
- - **RoamClient**authenticated HTTP client for Roam's local API
10
- - **Tool definitions**Zod-validated tool schemas used by both MCP and CLI
11
- - **Operations** page, block, search, query, file, and navigation operations
12
- - **Graph resolution** config loading, graph lookup, and multi-graph support
13
- - **Types** shared TypeScript types, error codes, and schemas
13
+ - `RoamActionClient`structural client interface (`call()` + optional `getTokenInfo()`). Bring your own implementation.
14
+ - `routeToolCall(name, args, options)` central dispatcher. **Requires** `options.resolveGraph` and `options.createClient`. Optional: `tokenInfoMode`, `onTokenStatusUpdate`.
15
+ - `ToolGraph` / `ResolvedGraph` cross-transport graph identity types.
16
+ - Tool registry: `dataTools` (graph content, reusable across transports), `desktopUiTools` (file ops + window/selection — local-only), `contentTools` (the union), `tools` (alias of contentTools at this layer).
17
+ - Helpers: `defineTool`, `defineStandaloneTool`, `findTool`.
18
+ - Operations: page, block, search, query, datalog, navigation, files (all transport-agnostic — they only call `client.call(...)`).
19
+ - Types and schemas: `GraphConfigSchema`, `RoamMcpConfigSchema`, `RoamError`, `ErrorCodes`, `EXPECTED_API_VERSION`, etc.
20
+
21
+ ## What's NOT in here
22
+
23
+ - `RoamClient` — the local Roam Desktop transport, in `@roam-research/roam-tools-local`.
24
+ - `~/.roam-tools.json` reader (`getPort`, `resolveGraph`, `getMcpConfig`, etc.) — also in `@roam-research/roam-tools-local`.
25
+ - `connect` interactive setup — also in `@roam-research/roam-tools-local`.
26
+ - The `list_graphs` and `setup_new_graph` standalone tools — also local.
27
+
28
+ Hosted consumers reimplement these (or substitute their own equivalents — e.g., reading picker grants from a remote store) and inject them via `routeToolCall`'s options.
14
29
 
15
30
  ## Documentation
16
31
 
17
- See the [main repository](https://github.com/Roam-Research/roam-tools) for full documentation.
32
+ See the [main repository](https://github.com/Roam-Research/roam-tools) for full documentation, including the architecture rationale and the integration pattern.
package/dist/index.d.ts CHANGED
@@ -1,9 +1,5 @@
1
- export type { CallToolResult, TextContent, ImageContent, GraphType, AccessLevel, GraphConfig, RoamMcpConfig, ResolvedGraph, ErrorCode, RoamApiError, RoamResponse, RoamClientConfig, Block, Page, BlockLocation, WindowType, SidebarWindow, SidebarWindowInfo, FocusedBlock, SelectedBlock, MainWindowViewType, MainWindowView, SearchResultPath, SearchResult, SearchResponse, RecentlyOpenedBlock, RecentlyOpenedItem, DailyNotePagesViewItem, RecentlyEditedPage, SearchSuggestionsResponse, SearchTemplatesResponse, GetPageResponse, GetBlockResponse, Template, QueryResult, QueryResponse, TokenInfoResponse, TokenInfoResult, } from "./types.js";
1
+ export type { CallToolResult, TextContent, ImageContent, GraphType, AccessLevel, GraphConfig, RoamMcpConfig, ToolGraph, ResolvedGraph, RoamActionClient, ErrorCode, RoamApiError, RoamResponse, Block, Page, BlockLocation, WindowType, SidebarWindow, SidebarWindowInfo, FocusedBlock, SelectedBlock, MainWindowViewType, MainWindowView, SearchResultPath, SearchResult, SearchResponse, RecentlyOpenedBlock, RecentlyOpenedItem, DailyNotePagesViewItem, RecentlyEditedPage, SearchSuggestionsResponse, SearchTemplatesResponse, GetPageResponse, GetBlockResponse, Template, QueryResult, QueryResponse, TokenInfoResponse, TokenInfoResult, } from "./types.js";
2
2
  export { GraphConfigSchema, RoamMcpConfigSchema, ErrorCodes, RoamError, CONFIG_VERSION, EXPECTED_API_VERSION, textResult, imageResult, errorResult, getErrorMessage, } from "./types.js";
3
- export { RoamClient } from "./client.js";
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";
7
- export { tools, findTool, routeToolCall } from "./tools.js";
8
- export type { ToolDefinition, ClientToolDefinition, StandaloneToolDefinition } from "./tools.js";
3
+ export { tools, findTool, routeToolCall, contentTools, dataTools, desktopUiTools, defineTool, defineStandaloneTool, } from "./tools.js";
4
+ export type { ToolDefinition, ClientToolDefinition, StandaloneToolDefinition, RouteToolCallOptions, } from "./tools.js";
9
5
  //# 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,EACd,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,KAAK,EACL,IAAI,EACJ,aAAa,EACb,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,eAAe,GAChB,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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,YAAY,EACV,cAAc,EACd,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,EACX,WAAW,EACX,aAAa,EACb,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,IAAI,EACJ,aAAa,EACb,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,eAAe,GAChB,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,EACL,KAAK,EACL,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,SAAS,EACT,cAAc,EACd,UAAU,EACV,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  // Barrel export for @roam-research/roam-tools-core
2
+ //
3
+ // Core is transport-agnostic — it does NOT export RoamClient, the
4
+ // ~/.roam-tools.json reader, or the connect command. Those live in
5
+ // @roam-research/roam-tools-local. Hosted MCP transports depend on this
6
+ // package directly and supply their own resolveGraph + createClient via
7
+ // routeToolCall's options.
2
8
  export { GraphConfigSchema, RoamMcpConfigSchema, ErrorCodes, RoamError, CONFIG_VERSION, EXPECTED_API_VERSION, textResult, imageResult, errorResult, getErrorMessage, } from "./types.js";
3
- // Client
4
- export { RoamClient } from "./client.js";
5
- // Graph resolution and config management
6
- export { getPort, resolveGraph, saveGraphToConfig, removeGraphFromConfig, updateGraphTokenStatus, getConfiguredGraphsSafe, getConfiguredGraphs, findGraphConfig, getMcpConfig, getOpenGraphs, } from "./graph-resolver.js";
7
- // Shared Roam API functions
8
- export { fetchAvailableGraphs, requestToken, sleep, openRoamApp, slugify } from "./roam-api.js";
9
- // Tool definitions and routing
10
- export { tools, findTool, routeToolCall } from "./tools.js";
9
+ // Tool definitions, helpers, and routing
10
+ export { tools, findTool, routeToolCall, contentTools, dataTools, desktopUiTools, defineTool, defineStandaloneTool, } from "./tools.js";
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { RoamClient } from "../client.js";
3
- import type { CallToolResult } from "../types.js";
2
+ import type { CallToolResult, RoamActionClient } from "../types.js";
4
3
  export declare const CreateBlockSchema: z.ZodObject<{
5
4
  parentUid: z.ZodOptional<z.ZodString>;
6
5
  pageTitle: z.ZodOptional<z.ZodString>;
@@ -127,12 +126,12 @@ export interface GetBacklinksResponse {
127
126
  total: number;
128
127
  results: BacklinkResult[];
129
128
  }
130
- export declare function createBlock(client: RoamClient, params: CreateBlockParams): Promise<CallToolResult>;
131
- export declare function getBlock(client: RoamClient, params: GetBlockParams): Promise<CallToolResult>;
132
- export declare function updateBlock(client: RoamClient, params: UpdateBlockParams): Promise<CallToolResult>;
133
- export declare function deleteBlock(client: RoamClient, params: DeleteBlockParams): Promise<CallToolResult>;
134
- export declare function moveBlock(client: RoamClient, params: MoveBlockParams): Promise<CallToolResult>;
135
- export declare function getBacklinks(client: RoamClient, params: GetBacklinksParams): Promise<CallToolResult>;
129
+ export declare function createBlock(client: RoamActionClient, params: CreateBlockParams): Promise<CallToolResult>;
130
+ export declare function getBlock(client: RoamActionClient, params: GetBlockParams): Promise<CallToolResult>;
131
+ export declare function updateBlock(client: RoamActionClient, params: UpdateBlockParams): Promise<CallToolResult>;
132
+ export declare function deleteBlock(client: RoamActionClient, params: DeleteBlockParams): Promise<CallToolResult>;
133
+ export declare function moveBlock(client: RoamActionClient, params: MoveBlockParams): Promise<CallToolResult>;
134
+ export declare function getBacklinks(client: RoamActionClient, params: GetBacklinksParams): Promise<CallToolResult>;
136
135
  export declare const AddCommentSchema: z.ZodObject<{
137
136
  blockUid: z.ZodString;
138
137
  comment: z.ZodOptional<z.ZodString>;
@@ -171,6 +170,6 @@ export interface GetCommentsResponse {
171
170
  total: number;
172
171
  comments: CommentResult[];
173
172
  }
174
- export declare function addComment(client: RoamClient, params: AddCommentParams): Promise<CallToolResult>;
175
- export declare function getComments(client: RoamClient, params: GetCommentsParams): Promise<CallToolResult>;
173
+ export declare function addComment(client: RoamActionClient, params: AddCommentParams): Promise<CallToolResult>;
174
+ export declare function getComments(client: RoamActionClient, params: GetCommentsParams): Promise<CallToolResult>;
176
175
  //# sourceMappingURL=blocks.d.ts.map
@@ -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;;;;;;;;;;;;;;;;;;;;;EA+B5B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;EAMzB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;EAU5B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;EAE5B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;EAM1B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsB7B,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,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ACvB,OAAO,CAAC,cAAc,CAAC,CA0BzB;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,cAAc,CAAC,CAMzB"}
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { RoamClient } from "../client.js";
3
- import type { CallToolResult } from "../types.js";
2
+ import type { CallToolResult, RoamActionClient } from "../types.js";
4
3
  export declare const DatalogQuerySchema: z.ZodObject<{
5
4
  query: z.ZodString;
6
5
  inputs: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
@@ -12,5 +11,5 @@ export declare const DatalogQuerySchema: z.ZodObject<{
12
11
  inputs?: unknown[] | undefined;
13
12
  }>;
14
13
  export type DatalogQueryParams = z.infer<typeof DatalogQuerySchema>;
15
- export declare function datalogQuery(client: RoamClient, params: DatalogQueryParams): Promise<CallToolResult>;
14
+ export declare function datalogQuery(client: RoamActionClient, params: DatalogQueryParams): Promise<CallToolResult>;
16
15
  //# sourceMappingURL=datalog.d.ts.map
@@ -1 +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"}
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,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpE,eAAO,MAAM,kBAAkB;;;;;;;;;EAQ7B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,wBAAsB,YAAY,CAChC,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,cAAc,CAAC,CAIzB"}
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { RoamClient } from "../client.js";
3
- import type { CallToolResult } from "../types.js";
2
+ import type { CallToolResult, RoamActionClient } from "../types.js";
4
3
  export declare const FileGetSchema: z.ZodObject<{
5
4
  url: z.ZodString;
6
5
  }, "strip", z.ZodTypeAny, {
@@ -37,7 +36,7 @@ export declare const FileDeleteSchema: z.ZodObject<{
37
36
  export type FileGetParams = z.infer<typeof FileGetSchema>;
38
37
  export type FileUploadParams = z.infer<typeof FileUploadSchema>;
39
38
  export type FileDeleteParams = z.infer<typeof FileDeleteSchema>;
40
- export declare function getFile(client: RoamClient, params: FileGetParams): Promise<CallToolResult>;
41
- export declare function uploadFile(client: RoamClient, params: FileUploadParams): Promise<CallToolResult>;
42
- export declare function deleteFile(client: RoamClient, params: FileDeleteParams): Promise<CallToolResult>;
39
+ export declare function getFile(client: RoamActionClient, params: FileGetParams): Promise<CallToolResult>;
40
+ export declare function uploadFile(client: RoamActionClient, params: FileUploadParams): Promise<CallToolResult>;
41
+ export declare function deleteFile(client: RoamActionClient, params: FileDeleteParams): Promise<CallToolResult>;
43
42
  //# sourceMappingURL=files.d.ts.map
@@ -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,KA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AAC;AAC1D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AA+GhE,wBAAsB,OAAO,CAC3B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,cAAc,CAAC,CAkBzB;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,cAAc,CAAC,CAiDzB;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,cAAc,CAAC,CAGzB"}
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { RoamClient } from "../client.js";
3
- import type { CallToolResult } from "../types.js";
2
+ import type { CallToolResult, RoamActionClient } from "../types.js";
4
3
  export declare const GetOpenWindowsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
5
4
  export declare const GetSelectionSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
6
5
  export declare const OpenMainWindowSchema: z.ZodObject<{
@@ -25,8 +24,8 @@ export declare const OpenSidebarSchema: z.ZodObject<{
25
24
  }>;
26
25
  export type OpenMainWindowParams = z.infer<typeof OpenMainWindowSchema>;
27
26
  export type OpenSidebarParams = z.infer<typeof OpenSidebarSchema>;
28
- export declare function getOpenWindows(client: RoamClient): Promise<CallToolResult>;
29
- export declare function getSelection(client: RoamClient): Promise<CallToolResult>;
30
- export declare function openMainWindow(client: RoamClient, params: OpenMainWindowParams): Promise<CallToolResult>;
31
- export declare function openSidebar(client: RoamClient, params: OpenSidebarParams): Promise<CallToolResult>;
27
+ export declare function getOpenWindows(client: RoamActionClient): Promise<CallToolResult>;
28
+ export declare function getSelection(client: RoamActionClient): Promise<CallToolResult>;
29
+ export declare function openMainWindow(client: RoamActionClient, params: OpenMainWindowParams): Promise<CallToolResult>;
30
+ export declare function openSidebar(client: RoamActionClient, params: OpenSidebarParams): Promise<CallToolResult>;
32
31
  //# sourceMappingURL=navigation.d.ts.map
@@ -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,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"}
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,EAKV,cAAc,EACd,gBAAgB,EACjB,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,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CAStF;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CASpF;AAED,wBAAsB,cAAc,CAClC,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,cAAc,CAAC,CAQzB;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,cAAc,CAAC,CAUzB"}
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { RoamClient } from "../client.js";
3
- import type { CallToolResult } from "../types.js";
2
+ import type { CallToolResult, RoamActionClient } from "../types.js";
4
3
  export declare const CreatePageSchema: z.ZodObject<{
5
4
  title: z.ZodString;
6
5
  markdown: z.ZodOptional<z.ZodString>;
@@ -58,9 +57,9 @@ export type CreatePageParams = z.infer<typeof CreatePageSchema>;
58
57
  export type GetPageParams = z.infer<typeof GetPageSchema>;
59
58
  export type DeletePageParams = z.infer<typeof DeletePageSchema>;
60
59
  export type UpdatePageParams = z.infer<typeof UpdatePageSchema>;
61
- export declare function createPage(client: RoamClient, params: CreatePageParams): Promise<CallToolResult>;
62
- export declare function getPage(client: RoamClient, params: GetPageParams): Promise<CallToolResult>;
63
- export declare function deletePage(client: RoamClient, params: DeletePageParams): Promise<CallToolResult>;
64
- export declare function updatePage(client: RoamClient, params: UpdatePageParams): Promise<CallToolResult>;
65
- export declare function getGuidelines(client: RoamClient): Promise<CallToolResult>;
60
+ export declare function createPage(client: RoamActionClient, params: CreatePageParams): Promise<CallToolResult>;
61
+ export declare function getPage(client: RoamActionClient, params: GetPageParams): Promise<CallToolResult>;
62
+ export declare function deletePage(client: RoamActionClient, params: DeletePageParams): Promise<CallToolResult>;
63
+ export declare function updatePage(client: RoamActionClient, params: UpdatePageParams): Promise<CallToolResult>;
64
+ export declare function getGuidelines(client: RoamActionClient): Promise<CallToolResult>;
66
65
  //# sourceMappingURL=pages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/operations/pages.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,EAAmB,MAAM,aAAa,CAAC;AAInE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;EAa3B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;EAOxB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;EAa3B,CAAC;AAEH,eAAO,MAAM,mBAAmB,gDAAe,CAAC;AAGhD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,C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AAC1D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,wBAAsB,UAAU,CAC9B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,cAAc,CAAC,CASzB;AAED,wBAAsB,OAAO,CAC3B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,cAAc,CAAC,CAQzB;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,cAAc,CAAC,CAGzB;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,cAAc,CAAC,CAUzB;AAED,wBAAsB,aAAa,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CA0BrF"}
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { RoamClient } from "../client.js";
3
- import type { CallToolResult } from "../types.js";
2
+ import type { CallToolResult, RoamActionClient } from "../types.js";
4
3
  export declare const QuerySchema: z.ZodObject<{
5
4
  uid: z.ZodOptional<z.ZodString>;
6
5
  query: z.ZodOptional<z.ZodString>;
@@ -30,5 +29,5 @@ export declare const QuerySchema: z.ZodObject<{
30
29
  query?: string | undefined;
31
30
  }>;
32
31
  export type QueryParams = z.infer<typeof QuerySchema>;
33
- export declare function query(client: RoamClient, params: QueryParams): Promise<CallToolResult>;
32
+ export declare function query(client: RoamActionClient, params: QueryParams): Promise<CallToolResult>;
34
33
  //# sourceMappingURL=query.d.ts.map
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;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"}
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,EAAiB,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAKnF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BtB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,wBAAsB,KAAK,CACzB,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,cAAc,CAAC,CA2BzB"}
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { RoamClient } from "../client.js";
3
- import type { CallToolResult } from "../types.js";
2
+ import type { CallToolResult, RoamActionClient } from "../types.js";
4
3
  export declare const SearchSchema: z.ZodObject<{
5
4
  query: z.ZodString;
6
5
  scope: z.ZodOptional<z.ZodEnum<["pages", "blocks", "all"]>>;
@@ -32,6 +31,6 @@ export declare const SearchTemplatesSchema: z.ZodObject<{
32
31
  }>;
33
32
  export type SearchParams = z.infer<typeof SearchSchema>;
34
33
  export type SearchTemplatesParams = z.infer<typeof SearchTemplatesSchema>;
35
- export declare function search(client: RoamClient, params: SearchParams): Promise<CallToolResult>;
36
- export declare function searchTemplates(client: RoamClient, params: SearchTemplatesParams): Promise<CallToolResult>;
34
+ export declare function search(client: RoamActionClient, params: SearchParams): Promise<CallToolResult>;
35
+ export declare function searchTemplates(client: RoamActionClient, params: SearchTemplatesParams): Promise<CallToolResult>;
37
36
  //# sourceMappingURL=search.d.ts.map
@@ -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,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"}
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,EAIV,cAAc,EACd,gBAAgB,EACjB,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,CAC1B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,cAAc,CAAC,CAczB;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,cAAc,CAAC,CAKzB"}
package/dist/tools.d.ts CHANGED
@@ -1,11 +1,10 @@
1
1
  import { z } from "zod";
2
- import type { CallToolResult } from "./types.js";
3
- import { RoamClient } from "./client.js";
2
+ import type { CallToolResult, AccessLevel, RoamActionClient, ToolGraph } from "./types.js";
4
3
  export interface ClientToolDefinition {
5
4
  name: string;
6
5
  description: string;
7
6
  schema: z.ZodObject<z.ZodRawShape>;
8
- action: (client: RoamClient, args: unknown) => Promise<CallToolResult>;
7
+ action: (client: RoamActionClient, args: unknown) => Promise<CallToolResult>;
9
8
  type: "client";
10
9
  }
11
10
  export interface StandaloneToolDefinition {
@@ -16,7 +15,41 @@ export interface StandaloneToolDefinition {
16
15
  type: "standalone";
17
16
  }
18
17
  export type ToolDefinition = ClientToolDefinition | StandaloneToolDefinition;
18
+ export declare function defineTool<T extends z.ZodRawShape>(name: string, description: string, schema: z.ZodObject<T>, action: (client: RoamActionClient, args: z.infer<z.ZodObject<T>>) => Promise<CallToolResult>): ClientToolDefinition;
19
+ export declare function defineStandaloneTool<T extends z.ZodRawShape>(name: string, description: string, schema: z.ZodObject<T>, action: (args: z.infer<z.ZodObject<T>>) => Promise<CallToolResult>): StandaloneToolDefinition;
20
+ export declare const dataTools: ClientToolDefinition[];
21
+ export declare const desktopUiTools: ClientToolDefinition[];
22
+ export declare const contentTools: ClientToolDefinition[];
19
23
  export declare const tools: ToolDefinition[];
20
24
  export declare function findTool(name: string): ToolDefinition | undefined;
21
- export declare function routeToolCall(toolName: string, args: Record<string, unknown>): Promise<CallToolResult>;
25
+ export interface RouteToolCallOptions {
26
+ /**
27
+ * Resolve a graph identifier (nickname/name) to a ToolGraph. Required.
28
+ * Local consumers use the resolver from @roam-research/roam-tools-local;
29
+ * hosted consumers wire their own (e.g., reading picker grants from RTDB).
30
+ */
31
+ resolveGraph: (providedGraph?: string) => Promise<ToolGraph>;
32
+ /**
33
+ * Construct a client for the resolved graph. Required.
34
+ * Local consumers return a RoamClient; hosted consumers return a transport
35
+ * that talks to proxy.api.roamresearch.com.
36
+ */
37
+ createClient: (graph: ToolGraph) => Promise<RoamActionClient> | RoamActionClient;
38
+ /**
39
+ * "local-sync" runs the desktop token-info side-flow on get_graph_guidelines:
40
+ * parallel getTokenInfo, access-level validation, status writes, and result
41
+ * enrichment. "skip" (default) disables that side-flow entirely. Graph-name
42
+ * prefix (prependGraphInfo) is unaffected by this mode and runs in both.
43
+ */
44
+ tokenInfoMode?: "local-sync" | "skip";
45
+ /**
46
+ * Only consulted in local-sync mode. Hosted callers may use this to write to
47
+ * their own grant store. If omitted, status changes are not persisted.
48
+ */
49
+ onTokenStatusUpdate?: (nickname: string, patch: {
50
+ accessLevel?: AccessLevel;
51
+ lastKnownTokenStatus?: "active" | "revoked";
52
+ }) => Promise<void>;
53
+ }
54
+ export declare function routeToolCall(toolName: string, args: Record<string, unknown>, options: RouteToolCallOptions): Promise<CallToolResult>;
22
55
  //# sourceMappingURL=tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAkC,MAAM,YAAY,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA+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M,cAAc,EAAE,oBAAoB,EA4ChD,CAAC;AAGF,eAAO,MAAM,YAAY,EAAE,oBAAoB,EAAsC,CAAC;AAKtF,eAAO,MAAM,KAAK,EAAE,cAAc,EAAsC,CAAC;AAEzE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAEjE;AAuFD,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,YAAY,EAAE,CAAC,aAAa,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;IAC7D;;;;OAIG;IACH,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAAC;IACjF;;;;;OAKG;IACH,aAAa,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IACtC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,CACpB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE;QAAE,WAAW,CAAC,EAAE,WAAW,CAAC;QAAC,oBAAoB,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;KAAE,KAC9E,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AAED,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,cAAc,CAAC,CAqIzB"}
package/dist/tools.js CHANGED
@@ -1,7 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import { RoamError } from "./types.js";
3
- import { RoamClient } from "./client.js";
4
- import { resolveGraph, getPort, updateGraphTokenStatus } from "./graph-resolver.js";
5
3
  import { CreatePageSchema, GetPageSchema, DeletePageSchema, UpdatePageSchema, GetGuidelinesSchema, createPage, getPage, deletePage, updatePage, getGuidelines, } from "./operations/pages.js";
6
4
  import { CreateBlockSchema, GetBlockSchema, UpdateBlockSchema, DeleteBlockSchema, MoveBlockSchema, GetBacklinksSchema, AddCommentSchema, GetCommentsSchema, createBlock, getBlock, updateBlock, deleteBlock, moveBlock, getBacklinks, addComment, getComments, } from "./operations/blocks.js";
7
5
  import { SearchSchema, SearchTemplatesSchema, search, searchTemplates, } from "./operations/search.js";
@@ -9,7 +7,6 @@ import { QuerySchema, query } from "./operations/query.js";
9
7
  import { DatalogQuerySchema, datalogQuery } from "./operations/datalog.js";
10
8
  import { GetOpenWindowsSchema, GetSelectionSchema, OpenMainWindowSchema, OpenSidebarSchema, getOpenWindows, getSelection, openMainWindow, openSidebar, } from "./operations/navigation.js";
11
9
  import { FileGetSchema, FileUploadSchema, FileDeleteSchema, getFile, uploadFile, deleteFile, } from "./operations/files.js";
12
- import { ListGraphsSchema, SetupNewGraphSchema, listGraphs, setupNewGraph, } from "./operations/graphs.js";
13
10
  // Common schema for graph parameter (used by most tools)
14
11
  const GraphSchema = z.object({
15
12
  graph: z
@@ -22,7 +19,7 @@ function withGraph(schema) {
22
19
  return schema.extend(GraphSchema.shape);
23
20
  }
24
21
  // Helper to create tool with graph parameter
25
- function defineTool(name, description, schema, action) {
22
+ export function defineTool(name, description, schema, action) {
26
23
  return {
27
24
  name,
28
25
  description,
@@ -32,7 +29,7 @@ function defineTool(name, description, schema, action) {
32
29
  };
33
30
  }
34
31
  // Helper to create standalone tool (no graph parameter, handles its own resolution)
35
- function defineStandaloneTool(name, description, schema, action) {
32
+ export function defineStandaloneTool(name, description, schema, action) {
36
33
  return {
37
34
  name,
38
35
  description,
@@ -41,15 +38,10 @@ function defineStandaloneTool(name, description, schema, action) {
41
38
  type: "standalone",
42
39
  };
43
40
  }
44
- // Graph Management Tools (standalone - handle their own resolution)
45
- const graphManagementTools = [
46
- defineStandaloneTool("list_graphs", "List all configured graphs with their nicknames. Also provides setup instructions for connecting additional graphs.", ListGraphsSchema, listGraphs),
47
- defineStandaloneTool("setup_new_graph", "Set up a new Roam graph for access, or list available graphs. Call without arguments to see which graphs are available in Roam Desktop. Call with graph and nickname to connect a specific graph — ask the user what they'd like to call the graph before choosing a nickname. The user will see an approval dialog in Roam desktop app and must approve the token request. If the graph is already configured, returns the existing configuration without making changes.", SetupNewGraphSchema, setupNewGraph),
48
- ];
49
41
  // Note appended to all client tool descriptions
50
42
  const GUIDELINES_NOTE = "\n\nNote: Call get_graph_guidelines first when starting to work with a graph.";
51
- // Content Tools (require graph/client)
52
- const contentTools = [
43
+ // Data Tools (require graph/client; reusable across local + hosted MCP transports)
44
+ export const dataTools = [
53
45
  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),
54
46
  defineTool("create_page", "Create a new page in Roam, optionally with markdown content." + GUIDELINES_NOTE, CreatePageSchema, createPage),
55
47
  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." +
@@ -78,6 +70,10 @@ const contentTools = [
78
70
  GUIDELINES_NOTE, GetBlockSchema, getBlock),
79
71
  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
72
  GUIDELINES_NOTE, GetBacklinksSchema, getBacklinks),
73
+ ];
74
+ // Desktop UI Tools (require local Roam Desktop — file ops + window/selection introspection;
75
+ // hosted MCP omits these because the parameters/effects assume a local environment).
76
+ export const desktopUiTools = [
81
77
  defineTool("get_open_windows", "Get the current view in the main window and all open sidebar windows." + GUIDELINES_NOTE, GetOpenWindowsSchema, getOpenWindows),
82
78
  defineTool("get_selection", "Get the currently focused block and any multi-selected blocks." + GUIDELINES_NOTE, GetSelectionSchema, getSelection),
83
79
  defineTool("open_main_window", "Navigate to a page or block in the main window." + GUIDELINES_NOTE, OpenMainWindowSchema, openMainWindow),
@@ -87,7 +83,12 @@ const contentTools = [
87
83
  GUIDELINES_NOTE, FileUploadSchema, uploadFile),
88
84
  defineTool("file_delete", "Delete a file hosted on Roam." + GUIDELINES_NOTE, FileDeleteSchema, deleteFile),
89
85
  ];
90
- export const tools = [...graphManagementTools, ...contentTools];
86
+ // Backwards-compatible aggregate of all client tools.
87
+ export const contentTools = [...dataTools, ...desktopUiTools];
88
+ // All client tools available in core. Local standalone tools (list_graphs,
89
+ // setup_new_graph) live in @roam-research/roam-tools-local since they touch
90
+ // ~/.roam-tools.json and the Roam Desktop API.
91
+ export const tools = [...dataTools, ...desktopUiTools];
91
92
  export function findTool(name) {
92
93
  return tools.find((t) => t.name === name);
93
94
  }
@@ -167,46 +168,40 @@ function roamErrorResult(error) {
167
168
  isError: true,
168
169
  };
169
170
  }
170
- export async function routeToolCall(toolName, args) {
171
+ export async function routeToolCall(toolName, args, options) {
171
172
  const tool = findTool(toolName);
172
173
  if (!tool) {
173
174
  throw new Error(`Unknown tool: ${toolName}`);
174
175
  }
176
+ // Core only registers client tools. Standalone tools live in
177
+ // @roam-research/roam-tools-local; route them through that wrapper.
178
+ if (tool.type !== "client") {
179
+ throw new Error(`Tool ${toolName}: core's routeToolCall only handles client tools. ` +
180
+ `Standalone tools live in @roam-research/roam-tools-local.`);
181
+ }
175
182
  // Validate and parse args with Zod
176
183
  const parsed = tool.schema.safeParse(args);
177
184
  if (!parsed.success) {
178
185
  throw new Error(`Invalid arguments: ${parsed.error.message}`);
179
186
  }
180
- // Handle standalone tools (graph management)
181
- if (tool.type === "standalone") {
182
- try {
183
- return await tool.action(parsed.data);
184
- }
185
- catch (error) {
186
- if (error instanceof RoamError) {
187
- return roamErrorResult(error);
188
- }
189
- throw error;
190
- }
191
- }
192
- // Handle client tools (require graph resolution)
187
+ const tokenInfoMode = options.tokenInfoMode ?? "skip";
188
+ const updateTokenStatus = options.onTokenStatusUpdate;
193
189
  try {
194
- // Extract graph from validated args and resolve it
195
- const { graph, ...restArgs } = parsed.data;
196
- const resolvedGraph = await resolveGraph(graph);
197
- const port = await getPort();
198
- // Create client with full config
199
- const client = new RoamClient({
200
- graphName: resolvedGraph.name,
201
- graphType: resolvedGraph.type,
202
- token: resolvedGraph.token,
203
- port,
204
- });
205
- // Special handling for get_graph_guidelines: sync token info in parallel
206
- if (tool.name === "get_graph_guidelines") {
190
+ const { graph: graphArg, ...restArgs } = parsed.data;
191
+ const graph = await options.resolveGraph(graphArg);
192
+ const client = await options.createClient(graph);
193
+ // Special handling for get_graph_guidelines: sync token info in parallel.
194
+ // Only fires in local-sync mode AND when the client implements getTokenInfo.
195
+ // Bind early so TS narrows the optional method through the truthy check.
196
+ const getTokenInfoFn = client.getTokenInfo?.bind(client);
197
+ if (tool.name === "get_graph_guidelines" && tokenInfoMode === "local-sync" && getTokenInfoFn) {
198
+ // In local-sync mode, the resolver is expected to return ResolvedGraph
199
+ // (with lastKnownTokenStatus). If a custom resolver omits the field,
200
+ // the read returns undefined and behavior is identical.
201
+ const resolvedGraph = graph;
207
202
  const [actionSettled, tokenInfoSettled] = await Promise.allSettled([
208
203
  tool.action(client, restArgs),
209
- client.getTokenInfo(),
204
+ getTokenInfoFn(),
210
205
  ]);
211
206
  // getTokenInfo() never throws, so always fulfilled
212
207
  const tokenInfoResult = tokenInfoSettled.status === "fulfilled"
@@ -214,9 +209,9 @@ export async function routeToolCall(toolName, args) {
214
209
  : { status: "unknown" };
215
210
  // Handle revoked token FIRST (before examining action result)
216
211
  if (tokenInfoResult.status === "revoked") {
217
- if (resolvedGraph.lastKnownTokenStatus !== "revoked") {
212
+ if (updateTokenStatus && resolvedGraph.lastKnownTokenStatus !== "revoked") {
218
213
  try {
219
- await updateGraphTokenStatus(resolvedGraph.nickname, {
214
+ await updateTokenStatus(resolvedGraph.nickname, {
220
215
  lastKnownTokenStatus: "revoked",
221
216
  });
222
217
  }
@@ -238,17 +233,17 @@ export async function routeToolCall(toolName, args) {
238
233
  const result = actionSettled.value;
239
234
  if (tokenInfoResult.status === "active") {
240
235
  const info = tokenInfoResult.info;
241
- // Validate access level before writing to prevent config corruption
236
+ // Validate access level before writing to prevent status corruption
242
237
  const validLevels = ["read-only", "read-append", "full"];
243
238
  const level = validLevels.includes(info.grantedAccessLevel)
244
239
  ? info.grantedAccessLevel
245
240
  : undefined;
246
- // Only write to config if something actually changed
241
+ // Only write if something actually changed
247
242
  const accessLevelChanged = level && resolvedGraph.accessLevel !== level;
248
243
  const tokenStatusChanged = resolvedGraph.lastKnownTokenStatus !== "active";
249
- if (accessLevelChanged || tokenStatusChanged) {
244
+ if (updateTokenStatus && (accessLevelChanged || tokenStatusChanged)) {
250
245
  try {
251
- await updateGraphTokenStatus(resolvedGraph.nickname, {
246
+ await updateTokenStatus(resolvedGraph.nickname, {
252
247
  ...(accessLevelChanged ? { accessLevel: level } : {}),
253
248
  lastKnownTokenStatus: "active",
254
249
  });
@@ -264,9 +259,9 @@ export async function routeToolCall(toolName, args) {
264
259
  return result;
265
260
  }
266
261
  // status === "unknown" — action succeeded, so token isn't revoked; clear stale status
267
- if (resolvedGraph.lastKnownTokenStatus !== "active") {
262
+ if (updateTokenStatus && resolvedGraph.lastKnownTokenStatus !== "active") {
268
263
  try {
269
- await updateGraphTokenStatus(resolvedGraph.nickname, { lastKnownTokenStatus: "active" });
264
+ await updateTokenStatus(resolvedGraph.nickname, { lastKnownTokenStatus: "active" });
270
265
  }
271
266
  catch {
272
267
  // best-effort status update
@@ -277,11 +272,11 @@ export async function routeToolCall(toolName, args) {
277
272
  }
278
273
  return result;
279
274
  }
280
- // Normal flow for all other tools
275
+ // Normal flow for all other tools (and get_graph_guidelines when token-info
276
+ // sync is skipped or unavailable). Graph-name prefix runs in both modes.
281
277
  const result = await tool.action(client, restArgs);
282
- // Prepend graph info to successful responses
283
278
  if (!result.isError) {
284
- return prependGraphInfo(result, resolvedGraph.nickname);
279
+ return prependGraphInfo(result, graph.nickname);
285
280
  }
286
281
  return result;
287
282
  }