fix(mcp): use local sqlite scene storage
This commit is contained in:
@@ -41,8 +41,8 @@ export function registerCreateWall(server: McpServer, bridge: SceneBridge): void
|
||||
}
|
||||
|
||||
const wall = WallNode.parse({
|
||||
start,
|
||||
end,
|
||||
start: start as [number, number],
|
||||
end: end as [number, number],
|
||||
...(thickness !== undefined ? { thickness } : {}),
|
||||
...(height !== undefined ? { height } : {}),
|
||||
})
|
||||
|
||||
@@ -84,7 +84,7 @@ export function registerPlaceItem(server: McpServer, bridge: SceneBridge): void
|
||||
: {}
|
||||
|
||||
const item = ItemNode.parse({
|
||||
position,
|
||||
position: position as [number, number, number],
|
||||
rotation: [0, rotation ?? 0, 0],
|
||||
asset: baseAsset,
|
||||
...wallExtras,
|
||||
|
||||
@@ -21,7 +21,7 @@ export function parseToolText(content: StoredTextContent[]): Record<string, unkn
|
||||
* `expectedVersion`.
|
||||
*/
|
||||
export class InMemorySceneStore implements SceneStore {
|
||||
readonly backend = 'filesystem' as const
|
||||
readonly backend = 'sqlite' as const
|
||||
private readonly data = new Map<string, SceneWithGraph>()
|
||||
private idCounter = 0
|
||||
|
||||
|
||||
@@ -8,11 +8,15 @@ import { z } from 'zod'
|
||||
/** A node identifier — non-empty string. The core uses `${prefix}_${nanoid}`. */
|
||||
export const NodeIdSchema = z.string().min(1)
|
||||
|
||||
/** 2D point as [x, z] (floor plane). Matches core's tuple convention. */
|
||||
export const Vec2Schema = z.tuple([z.number(), z.number()])
|
||||
/**
|
||||
* 2D point as [x, z] (floor plane). Use array length constraints instead of
|
||||
* `z.tuple()` so MCP hosts that only accept JSON Schema's common `items` shape
|
||||
* can register the tools.
|
||||
*/
|
||||
export const Vec2Schema = z.array(z.number()).min(2).max(2)
|
||||
|
||||
/** 3D point as [x, y, z]. */
|
||||
export const Vec3Schema = z.tuple([z.number(), z.number(), z.number()])
|
||||
export const Vec3Schema = z.array(z.number()).min(3).max(3)
|
||||
|
||||
/**
|
||||
* A single patch operation. Union of create / update / delete.
|
||||
|
||||
@@ -41,7 +41,7 @@ export function registerSetZone(server: McpServer, bridge: SceneBridge): void {
|
||||
|
||||
const zone = ZoneNode.parse({
|
||||
name: label,
|
||||
polygon,
|
||||
polygon: polygon as Array<[number, number]>,
|
||||
metadata: properties ?? {},
|
||||
})
|
||||
const id = bridge.createNode(zone, levelId as AnyNodeId)
|
||||
|
||||
Reference in New Issue
Block a user