feat(mcp): add guided construction workflows
This commit is contained in:
@@ -2,7 +2,9 @@ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
||||
import type { AnyNode, AnyNodeId } from '@pascal-app/core/schema'
|
||||
import { z } from 'zod'
|
||||
import type { Patch as BridgePatch, SceneBridge } from '../bridge/scene-bridge'
|
||||
import type { SceneStore } from '../storage/types'
|
||||
import { ErrorCode, throwMcpError } from './errors'
|
||||
import { publishLiveSceneSnapshot } from './live-sync'
|
||||
import { PatchSchema } from './schemas'
|
||||
|
||||
export const applyPatchInput = {
|
||||
@@ -15,7 +17,11 @@ export const applyPatchOutput = {
|
||||
createdIds: z.array(z.string()),
|
||||
}
|
||||
|
||||
export function registerApplyPatch(server: McpServer, bridge: SceneBridge): void {
|
||||
export function registerApplyPatch(
|
||||
server: McpServer,
|
||||
bridge: SceneBridge,
|
||||
store?: SceneStore,
|
||||
): void {
|
||||
server.registerTool(
|
||||
'apply_patch',
|
||||
{
|
||||
@@ -50,6 +56,7 @@ export function registerApplyPatch(server: McpServer, bridge: SceneBridge): void
|
||||
|
||||
try {
|
||||
const result = bridge.applyPatch(bridgePatches)
|
||||
await publishLiveSceneSnapshot(bridge, store, 'apply_patch')
|
||||
const payload = {
|
||||
appliedOps: result.appliedOps,
|
||||
deletedIds: result.deletedIds as unknown as string[],
|
||||
|
||||
Reference in New Issue
Block a user