@tensor-cad/mcp 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/store/types.d.ts CHANGED
@@ -5,10 +5,20 @@
5
5
  * session, which is what the 2026-07-28 spec asks for: state crosses calls as
6
6
  * an explicit handle in the arguments, never as an implicit connection.
7
7
  *
8
- * `FileStore` is the only implementation. The live editor bridge is *not* a
9
- * second store: it observes this one through `subscribe` and mirrors it to a
10
- * running editor. Two stores could disagree about what a design is; one store
11
- * with a listener cannot.
8
+ * The live editor bridge is *not* a second store: it observes this one through
9
+ * `subscribe` and mirrors it to a running editor. Two stores could disagree
10
+ * about what a design is; one store with a listener cannot.
11
+ *
12
+ * ## Everything returns a promise, including what a local store answers at once
13
+ *
14
+ * `FileStore` holds its designs in memory and could answer most of this
15
+ * synchronously. A store behind a database cannot, and a caller that has to
16
+ * know which kind it is holding is a caller that breaks when the kind changes.
17
+ * So the signatures say promise throughout and the local implementation returns
18
+ * ones that are already resolved.
19
+ *
20
+ * That costs `FileStore` nothing it cannot afford, and it does not cost the
21
+ * bridge its contract either — see `subscribe`.
12
22
  */
13
23
  import type { Op } from "../ops.js";
14
24
  import type { Doc } from "@tensor-cad/engine";
@@ -65,13 +75,21 @@ export interface DocumentStore {
65
75
  * something, which is what lets the bridge attribute a change to the
66
76
  * connection that caused it without threading an origin through every
67
77
  * signature.
78
+ *
79
+ * Still true now that the mutating calls return promises, and it is worth
80
+ * saying why: an `async` method runs its body synchronously until its first
81
+ * `await`, and `FileStore` has none before it announces the change. So the
82
+ * listener fires while the caller is still inside the call, exactly as
83
+ * before, and only the settling of the promise happens later. A store that
84
+ * *did* await before announcing would break the bridge's attribution rather
85
+ * than its types, which is the kind of failure worth naming in advance.
68
86
  */
69
87
  subscribe(listener: StoreListener): () => void;
70
88
  /** Designs this server has open, newest first. */
71
- list(): DesignSummary[];
89
+ list(): Promise<DesignSummary[]>;
72
90
  /** `.tensorcad.json` files near the server's root that could be opened. */
73
91
  listFiles(): Promise<string[]>;
74
- create(options: NewDesignOptions): DesignRecord;
92
+ create(options: NewDesignOptions): Promise<DesignRecord>;
75
93
  /**
76
94
  * Take a document the engine produced — scaled, imported, derived — as a new
77
95
  * design in this session.
@@ -79,10 +97,10 @@ export interface DocumentStore {
79
97
  * Separate from `create`, which builds one from a preset or from nothing:
80
98
  * these arrive whole and there is nothing to build.
81
99
  */
82
- adopt(doc: Doc): DesignRecord;
100
+ adopt(doc: Doc): Promise<DesignRecord>;
83
101
  open(path: string): Promise<DesignRecord>;
84
- get(id: string): DesignRecord;
85
- apply(id: string, ops: Op[], expectedRevision?: number): ApplyOutcome;
102
+ get(id: string): Promise<DesignRecord>;
103
+ apply(id: string, ops: Op[], expectedRevision?: number): Promise<ApplyOutcome>;
86
104
  /**
87
105
  * The whole document, in place of a list of operations.
88
106
  *
@@ -92,19 +110,19 @@ export interface DocumentStore {
92
110
  * otherwise an `apply`: the revision is checked, the previous document goes
93
111
  * on the undo log, and the change is announced.
94
112
  */
95
- replace(id: string, doc: Doc, expectedRevision?: number): ApplyOutcome;
113
+ replace(id: string, doc: Doc, expectedRevision?: number): Promise<ApplyOutcome>;
96
114
  save(id: string, path?: string): Promise<{
97
115
  record: DesignRecord;
98
116
  path: string;
99
117
  bytes: number;
100
118
  }>;
101
- checkpoint(id: string, label?: string): CheckpointInfo;
102
- checkpoints(id: string): CheckpointInfo[];
119
+ checkpoint(id: string, label?: string): Promise<CheckpointInfo>;
120
+ checkpoints(id: string): Promise<CheckpointInfo[]>;
103
121
  /** Without a checkpoint id this undoes the most recent `apply`. */
104
- restore(id: string, checkpointId?: string): {
122
+ restore(id: string, checkpointId?: string): Promise<{
105
123
  record: DesignRecord;
106
124
  restoredFrom: string;
107
- };
125
+ }>;
108
126
  }
109
127
  /** Thrown when a mutating call names a revision that is no longer current. */
110
128
  export declare class RevisionConflictError extends Error {
package/tools.d.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import type { McpServer } from "@modelcontextprotocol/server";
9
9
  import type { DocumentStore } from "./store/types.js";
10
- export declare function registerTools(server: McpServer, store: DocumentStore): void;
10
+ import type { ArtifactSink } from "./artifacts.js";
11
+ export declare function registerTools(server: McpServer, store: DocumentStore, artifacts: ArtifactSink): void;
11
12
  /** The tools this server registers, in the order it registers them. */
12
13
  export declare const TOOL_NAMES: readonly ["tensorcad_list_designs", "tensorcad_new_design", "tensorcad_open_design", "tensorcad_save_design", "tensorcad_get_design", "tensorcad_get_block", "tensorcad_search_catalog", "tensorcad_apply_ops", "tensorcad_validate", "tensorcad_analyze", "tensorcad_generate_code", "tensorcad_checkpoint", "tensorcad_restore", "tensorcad_explain", "tensorcad_scale", "tensorcad_mup", "tensorcad_plan", "tensorcad_diff", "tensorcad_import_hf"];