@openfairygui/mcp 0.2.0-alpha.1 → 0.2.0-alpha.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/LICENSE +21 -0
- package/bin/ofgui-mcp.cjs +0 -0
- package/dist/index.d.cts +12 -11
- package/dist/index.d.mts +12 -11
- package/package.json +84 -84
- package/src/index.ts +1 -0
- package/src/resource-definitions.ts +2 -2
- package/src/server.ts +2 -3
- package/src/tool-handler.ts +18 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OpenFairyGUI Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/bin/ofgui-mcp.cjs
CHANGED
|
File without changes
|
package/dist/index.d.cts
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import { connectOpenFairyGuiMcpStdio } from "./stdio.cjs";
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
-
import { BackendRuntime } from "@openfairygui/backend";
|
|
4
3
|
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
4
|
+
import { BackendRuntime } from "@openfairygui/backend";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
|
|
7
|
-
//#region src/server.d.ts
|
|
8
|
-
interface CreateOpenFairyGuiMcpServerOptions {
|
|
9
|
-
runtime?: BackendRuntime;
|
|
10
|
-
name?: string;
|
|
11
|
-
version?: string;
|
|
12
|
-
}
|
|
13
|
-
declare function createOpenFairyGuiMcpServer(options?: CreateOpenFairyGuiMcpServerOptions): McpServer;
|
|
14
|
-
//#endregion
|
|
15
7
|
//#region src/tool-definitions.d.ts
|
|
16
8
|
declare const OPENFAIRYGUI_BACKEND_TOOL_PREFIX = "openfairygui_backend_";
|
|
17
9
|
declare const OPENFAIRYGUI_BACKEND_TOOL_NAMES: readonly ["openfairygui_backend_get_capabilities", "openfairygui_backend_open_session", "openfairygui_backend_open_project_session", "openfairygui_backend_get_session", "openfairygui_backend_apply_transaction", "openfairygui_backend_save_session", "openfairygui_backend_close_session", "openfairygui_backend_get_events", "openfairygui_backend_get_job", "openfairygui_backend_list_jobs", "openfairygui_backend_cancel_job", "openfairygui_backend_get_cache_snapshot", "openfairygui_backend_refresh_cache"];
|
|
@@ -342,7 +334,16 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
|
|
|
342
334
|
}];
|
|
343
335
|
//#endregion
|
|
344
336
|
//#region src/tool-handler.d.ts
|
|
345
|
-
|
|
337
|
+
type OpenFairyGuiBackendRuntime = Pick<BackendRuntime, 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache'>;
|
|
338
|
+
declare function callOpenFairyGuiBackendTool(runtime: OpenFairyGuiBackendRuntime, name: OpenFairyGuiBackendToolName, input: Record<string, unknown>): Promise<CallToolResult>;
|
|
339
|
+
//#endregion
|
|
340
|
+
//#region src/server.d.ts
|
|
341
|
+
interface CreateOpenFairyGuiMcpServerOptions {
|
|
342
|
+
runtime?: OpenFairyGuiBackendRuntime;
|
|
343
|
+
name?: string;
|
|
344
|
+
version?: string;
|
|
345
|
+
}
|
|
346
|
+
declare function createOpenFairyGuiMcpServer(options?: CreateOpenFairyGuiMcpServerOptions): McpServer;
|
|
346
347
|
//#endregion
|
|
347
348
|
//#region src/prompt-definitions.d.ts
|
|
348
349
|
declare const OPENFAIRYGUI_BACKEND_PROMPT_NAMES: readonly ["openfairygui_inspect_capabilities", "openfairygui_open_and_inspect_session", "openfairygui_plan_revision_checked_transaction", "openfairygui_save_session", "openfairygui_poll_runtime_state"];
|
|
@@ -378,4 +379,4 @@ declare const OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS: readonly [{
|
|
|
378
379
|
declare const OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI = "openfairygui://backend/capabilities";
|
|
379
380
|
declare const OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES: readonly ["openfairygui://backend/session/{sessionId}", "openfairygui://backend/cache/{sessionId}", "openfairygui://backend/job/{sessionId}/{jobId}"];
|
|
380
381
|
//#endregion
|
|
381
|
-
export { type BackendMethodName, type CreateOpenFairyGuiMcpServerOptions, OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI, OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS, OPENFAIRYGUI_BACKEND_PROMPT_NAMES, OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES, OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS, OPENFAIRYGUI_BACKEND_TOOL_NAMES, OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA, OPENFAIRYGUI_BACKEND_TOOL_PREFIX, type OpenFairyGuiBackendPromptName, type OpenFairyGuiBackendToolDefinition, type OpenFairyGuiBackendToolName, callOpenFairyGuiBackendTool, connectOpenFairyGuiMcpStdio, createOpenFairyGuiMcpServer };
|
|
382
|
+
export { type BackendMethodName, type CreateOpenFairyGuiMcpServerOptions, OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI, OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS, OPENFAIRYGUI_BACKEND_PROMPT_NAMES, OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES, OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS, OPENFAIRYGUI_BACKEND_TOOL_NAMES, OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA, OPENFAIRYGUI_BACKEND_TOOL_PREFIX, type OpenFairyGuiBackendPromptName, type OpenFairyGuiBackendRuntime, type OpenFairyGuiBackendToolDefinition, type OpenFairyGuiBackendToolName, callOpenFairyGuiBackendTool, connectOpenFairyGuiMcpStdio, createOpenFairyGuiMcpServer };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import { connectOpenFairyGuiMcpStdio } from "./stdio.mjs";
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { BackendRuntime } from "@openfairygui/backend";
|
|
5
4
|
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import { BackendRuntime } from "@openfairygui/backend";
|
|
6
6
|
|
|
7
|
-
//#region src/server.d.ts
|
|
8
|
-
interface CreateOpenFairyGuiMcpServerOptions {
|
|
9
|
-
runtime?: BackendRuntime;
|
|
10
|
-
name?: string;
|
|
11
|
-
version?: string;
|
|
12
|
-
}
|
|
13
|
-
declare function createOpenFairyGuiMcpServer(options?: CreateOpenFairyGuiMcpServerOptions): McpServer;
|
|
14
|
-
//#endregion
|
|
15
7
|
//#region src/tool-definitions.d.ts
|
|
16
8
|
declare const OPENFAIRYGUI_BACKEND_TOOL_PREFIX = "openfairygui_backend_";
|
|
17
9
|
declare const OPENFAIRYGUI_BACKEND_TOOL_NAMES: readonly ["openfairygui_backend_get_capabilities", "openfairygui_backend_open_session", "openfairygui_backend_open_project_session", "openfairygui_backend_get_session", "openfairygui_backend_apply_transaction", "openfairygui_backend_save_session", "openfairygui_backend_close_session", "openfairygui_backend_get_events", "openfairygui_backend_get_job", "openfairygui_backend_list_jobs", "openfairygui_backend_cancel_job", "openfairygui_backend_get_cache_snapshot", "openfairygui_backend_refresh_cache"];
|
|
@@ -342,7 +334,16 @@ declare const OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS: readonly [{
|
|
|
342
334
|
}];
|
|
343
335
|
//#endregion
|
|
344
336
|
//#region src/tool-handler.d.ts
|
|
345
|
-
|
|
337
|
+
type OpenFairyGuiBackendRuntime = Pick<BackendRuntime, 'getCapabilities' | 'openSession' | 'openProjectSession' | 'getSession' | 'applyTransaction' | 'saveSession' | 'closeSession' | 'getEvents' | 'getJob' | 'listJobs' | 'cancelJob' | 'getCacheSnapshot' | 'refreshCache'>;
|
|
338
|
+
declare function callOpenFairyGuiBackendTool(runtime: OpenFairyGuiBackendRuntime, name: OpenFairyGuiBackendToolName, input: Record<string, unknown>): Promise<CallToolResult>;
|
|
339
|
+
//#endregion
|
|
340
|
+
//#region src/server.d.ts
|
|
341
|
+
interface CreateOpenFairyGuiMcpServerOptions {
|
|
342
|
+
runtime?: OpenFairyGuiBackendRuntime;
|
|
343
|
+
name?: string;
|
|
344
|
+
version?: string;
|
|
345
|
+
}
|
|
346
|
+
declare function createOpenFairyGuiMcpServer(options?: CreateOpenFairyGuiMcpServerOptions): McpServer;
|
|
346
347
|
//#endregion
|
|
347
348
|
//#region src/prompt-definitions.d.ts
|
|
348
349
|
declare const OPENFAIRYGUI_BACKEND_PROMPT_NAMES: readonly ["openfairygui_inspect_capabilities", "openfairygui_open_and_inspect_session", "openfairygui_plan_revision_checked_transaction", "openfairygui_save_session", "openfairygui_poll_runtime_state"];
|
|
@@ -378,4 +379,4 @@ declare const OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS: readonly [{
|
|
|
378
379
|
declare const OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI = "openfairygui://backend/capabilities";
|
|
379
380
|
declare const OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES: readonly ["openfairygui://backend/session/{sessionId}", "openfairygui://backend/cache/{sessionId}", "openfairygui://backend/job/{sessionId}/{jobId}"];
|
|
380
381
|
//#endregion
|
|
381
|
-
export { type BackendMethodName, type CreateOpenFairyGuiMcpServerOptions, OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI, OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS, OPENFAIRYGUI_BACKEND_PROMPT_NAMES, OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES, OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS, OPENFAIRYGUI_BACKEND_TOOL_NAMES, OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA, OPENFAIRYGUI_BACKEND_TOOL_PREFIX, type OpenFairyGuiBackendPromptName, type OpenFairyGuiBackendToolDefinition, type OpenFairyGuiBackendToolName, callOpenFairyGuiBackendTool, connectOpenFairyGuiMcpStdio, createOpenFairyGuiMcpServer };
|
|
382
|
+
export { type BackendMethodName, type CreateOpenFairyGuiMcpServerOptions, OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI, OPENFAIRYGUI_BACKEND_PROMPT_DEFINITIONS, OPENFAIRYGUI_BACKEND_PROMPT_NAMES, OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES, OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS, OPENFAIRYGUI_BACKEND_TOOL_NAMES, OPENFAIRYGUI_BACKEND_TOOL_OUTPUT_SCHEMA, OPENFAIRYGUI_BACKEND_TOOL_PREFIX, type OpenFairyGuiBackendPromptName, type OpenFairyGuiBackendRuntime, type OpenFairyGuiBackendToolDefinition, type OpenFairyGuiBackendToolName, callOpenFairyGuiBackendTool, connectOpenFairyGuiMcpStdio, createOpenFairyGuiMcpServer };
|
package/package.json
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
2
|
+
"name": "@openfairygui/mcp",
|
|
3
|
+
"version": "0.2.0-alpha.3",
|
|
4
|
+
"description": "FairyGUI Headless Authoring SDK - MCP server adapter for the backend runtime.",
|
|
5
|
+
"author": "OpenFairyGUI Contributors",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/OpenFairyGUI/OpenFairyGUI.git",
|
|
10
|
+
"directory": "packages/mcp"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/OpenFairyGUI/OpenFairyGUI#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/OpenFairyGUI/OpenFairyGUI/issues"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"main": "./dist/index.cjs",
|
|
19
|
+
"module": "./dist/index.mjs",
|
|
20
|
+
"types": "./dist/index.d.mts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"require": {
|
|
24
|
+
"types": "./dist/index.d.cts",
|
|
25
|
+
"default": "./dist/index.cjs"
|
|
26
|
+
},
|
|
27
|
+
"default": {
|
|
28
|
+
"types": "./dist/index.d.mts",
|
|
29
|
+
"default": "./dist/index.mjs"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"./stdio": {
|
|
33
|
+
"require": {
|
|
34
|
+
"types": "./dist/stdio.d.cts",
|
|
35
|
+
"default": "./dist/stdio.cjs"
|
|
36
|
+
},
|
|
37
|
+
"default": {
|
|
38
|
+
"types": "./dist/stdio.d.mts",
|
|
39
|
+
"default": "./dist/stdio.mjs"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"bin": {
|
|
44
|
+
"ofgui-mcp": "bin/ofgui-mcp.cjs"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"dist/",
|
|
48
|
+
"bin/",
|
|
49
|
+
"src/"
|
|
50
|
+
],
|
|
51
|
+
"keywords": [
|
|
52
|
+
"fairygui",
|
|
53
|
+
"mcp",
|
|
54
|
+
"model-context-protocol",
|
|
55
|
+
"backend",
|
|
56
|
+
"authoring"
|
|
57
|
+
],
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
60
|
+
"zod": "^4.3.6",
|
|
61
|
+
"@openfairygui/backend": "0.2.0-alpha.3"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"ava": "^7.0.0",
|
|
65
|
+
"tsx": "^4.0.0",
|
|
66
|
+
"@openfairygui/core": "0.2.0-alpha.3"
|
|
67
|
+
},
|
|
68
|
+
"ava": {
|
|
69
|
+
"extensions": {
|
|
70
|
+
"ts": "module"
|
|
71
|
+
},
|
|
72
|
+
"nodeArguments": [
|
|
73
|
+
"--import",
|
|
74
|
+
"tsx/esm"
|
|
75
|
+
],
|
|
76
|
+
"files": [
|
|
77
|
+
"test/**/*.test.ts"
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
"scripts": {
|
|
81
|
+
"build": "tsdown src/index.ts src/stdio.ts --format esm,cjs --platform node --external node:fs --external node:path --external node:fs/promises --env.PACKAGE_VERSION=$npm_package_version",
|
|
82
|
+
"build:watch": "tsdown src/index.ts src/stdio.ts --watch --format esm,cjs --platform node --env.PACKAGE_VERSION=$npm_package_version",
|
|
83
|
+
"test": "ava test/**/*.test.ts --no-worker-threads"
|
|
84
|
+
}
|
|
85
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResourceTemplate, type McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import type { ReadResourceResult } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { OpenFairyGuiBackendRuntime } from './tool-handler.js';
|
|
4
4
|
|
|
5
5
|
const JSON_MIME_TYPE = 'application/json';
|
|
6
6
|
|
|
@@ -28,7 +28,7 @@ export const OPENFAIRYGUI_BACKEND_RESOURCE_TEMPLATES = [
|
|
|
28
28
|
'openfairygui://backend/job/{sessionId}/{jobId}',
|
|
29
29
|
] as const;
|
|
30
30
|
|
|
31
|
-
export function registerOpenFairyGuiBackendResources(server: McpServer, runtime:
|
|
31
|
+
export function registerOpenFairyGuiBackendResources(server: McpServer, runtime: OpenFairyGuiBackendRuntime): void {
|
|
32
32
|
server.registerResource(
|
|
33
33
|
'openfairygui_backend_capabilities',
|
|
34
34
|
OPENFAIRYGUI_BACKEND_CAPABILITIES_RESOURCE_URI,
|
package/src/server.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import type { BackendRuntime } from '@openfairygui/backend';
|
|
3
2
|
import { createNodeBackendRuntime } from '@openfairygui/backend/node';
|
|
4
3
|
import { registerOpenFairyGuiBackendPrompts } from './prompt-definitions.js';
|
|
5
4
|
import { registerOpenFairyGuiBackendResources } from './resource-definitions.js';
|
|
6
|
-
import { callOpenFairyGuiBackendTool } from './tool-handler.js';
|
|
5
|
+
import { callOpenFairyGuiBackendTool, type OpenFairyGuiBackendRuntime } from './tool-handler.js';
|
|
7
6
|
import {
|
|
8
7
|
OPENFAIRYGUI_BACKEND_TOOL_DEFINITIONS,
|
|
9
8
|
type OpenFairyGuiBackendToolName,
|
|
@@ -12,7 +11,7 @@ import {
|
|
|
12
11
|
const PACKAGE_VERSION = process.env.npm_package_version ?? '0.2.0-alpha.0';
|
|
13
12
|
|
|
14
13
|
export interface CreateOpenFairyGuiMcpServerOptions {
|
|
15
|
-
runtime?:
|
|
14
|
+
runtime?: OpenFairyGuiBackendRuntime;
|
|
16
15
|
name?: string;
|
|
17
16
|
version?: string;
|
|
18
17
|
}
|
package/src/tool-handler.ts
CHANGED
|
@@ -2,6 +2,23 @@ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
|
2
2
|
import type { BackendRuntime } from '@openfairygui/backend';
|
|
3
3
|
import type { OpenFairyGuiBackendToolName } from './tool-definitions.js';
|
|
4
4
|
|
|
5
|
+
export type OpenFairyGuiBackendRuntime = Pick<
|
|
6
|
+
BackendRuntime,
|
|
7
|
+
| 'getCapabilities'
|
|
8
|
+
| 'openSession'
|
|
9
|
+
| 'openProjectSession'
|
|
10
|
+
| 'getSession'
|
|
11
|
+
| 'applyTransaction'
|
|
12
|
+
| 'saveSession'
|
|
13
|
+
| 'closeSession'
|
|
14
|
+
| 'getEvents'
|
|
15
|
+
| 'getJob'
|
|
16
|
+
| 'listJobs'
|
|
17
|
+
| 'cancelJob'
|
|
18
|
+
| 'getCacheSnapshot'
|
|
19
|
+
| 'refreshCache'
|
|
20
|
+
>;
|
|
21
|
+
|
|
5
22
|
function jsonResult(payload: unknown, isError = false): CallToolResult {
|
|
6
23
|
return {
|
|
7
24
|
content: [
|
|
@@ -25,7 +42,7 @@ function isBackendFailure(value: unknown): boolean {
|
|
|
25
42
|
}
|
|
26
43
|
|
|
27
44
|
export async function callOpenFairyGuiBackendTool(
|
|
28
|
-
runtime:
|
|
45
|
+
runtime: OpenFairyGuiBackendRuntime,
|
|
29
46
|
name: OpenFairyGuiBackendToolName,
|
|
30
47
|
input: Record<string, unknown>,
|
|
31
48
|
): Promise<CallToolResult> {
|