@abraca/mcp 2.48.0 → 2.49.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.
@@ -12816,6 +12816,7 @@ const DISCONNECTED = {
12816
12816
  agentColor: "hsl(270, 80%, 60%)",
12817
12817
  getTreeMap: () => null,
12818
12818
  getTrashMap: () => null,
12819
+ refreshSpaces: async () => [],
12819
12820
  getDocSummary: () => null,
12820
12821
  getEnabledPluginNames: () => [],
12821
12822
  setActiveToolCall: () => {},
@@ -20306,6 +20307,21 @@ var AbracadabraMCPServer = class AbracadabraMCPServer {
20306
20307
  get spaces() {
20307
20308
  return this._spaces;
20308
20309
  }
20310
+ /**
20311
+ * Re-fetch the server's top-level `kind="space"` docs and refresh the
20312
+ * cached `_spaces` snapshot. {@link connect} only takes the snapshot once,
20313
+ * so a space created/seeded after connect (or removed) would otherwise stay
20314
+ * invisible to `list_spaces` until a full reconnect. Tools that surface the
20315
+ * space list should call this first so they reflect server truth.
20316
+ */
20317
+ async refreshSpaces() {
20318
+ if (!this.client) return this._spaces;
20319
+ try {
20320
+ const { spaces } = (0, _abraca_dabra.pickEntrySpace)(await this.client.listChildren());
20321
+ this._spaces = spaces;
20322
+ } catch {}
20323
+ return this._spaces;
20324
+ }
20309
20325
  get rootDocument() {
20310
20326
  return this._activeConnection?.doc ?? null;
20311
20327
  }
@@ -22927,7 +22943,7 @@ function registerTreeTools(mcp, server, validator = null) {
22927
22943
  });
22928
22944
  mcp.tool("list_spaces", "List all Spaces available on the server. Spaces are top-level documents (direct children of the server root) tagged with kind=\"space\". Returns id, label, public_access, and active flag. Use switch_space to navigate.", {}, async () => {
22929
22945
  server.setActiveToolCall({ name: "list_spaces" });
22930
- const spaces = server.spaces;
22946
+ const spaces = await server.refreshSpaces();
22931
22947
  if (!spaces.length) return { content: [{
22932
22948
  type: "text",
22933
22949
  text: "No spaces available — create one to get started."