fix(mcp): add shared operations and secure scene APIs
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
||||
import { z } from 'zod'
|
||||
import type { SceneBridge } from '../bridge/scene-bridge'
|
||||
import type { SceneStore } from '../storage/types'
|
||||
import type { SceneOperations } from '../operations'
|
||||
import { publishLiveSceneSnapshot } from './live-sync'
|
||||
|
||||
export const undoInput = {
|
||||
@@ -12,7 +11,7 @@ export const undoOutput = {
|
||||
undone: z.number(),
|
||||
}
|
||||
|
||||
export function registerUndo(server: McpServer, bridge: SceneBridge, store?: SceneStore): void {
|
||||
export function registerUndo(server: McpServer, bridge: SceneOperations): void {
|
||||
server.registerTool(
|
||||
'undo',
|
||||
{
|
||||
@@ -24,7 +23,7 @@ export function registerUndo(server: McpServer, bridge: SceneBridge, store?: Sce
|
||||
},
|
||||
async ({ steps }) => {
|
||||
const undone = bridge.undo(steps ?? 1)
|
||||
if (undone > 0) await publishLiveSceneSnapshot(bridge, store, 'undo')
|
||||
if (undone > 0) await publishLiveSceneSnapshot(bridge, 'undo')
|
||||
const payload = { undone }
|
||||
return {
|
||||
content: [{ type: 'text' as const, text: JSON.stringify(payload) }],
|
||||
|
||||
Reference in New Issue
Block a user