@sap-ux/fiori-mcp-server 0.0.4 → 0.0.6
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/dist/server.d.ts +4 -0
- package/dist/server.js +20 -4
- package/dist/telemetry/index.d.ts +68 -0
- package/dist/telemetry/index.js +146 -0
- package/dist/tools/execute-functionality.d.ts +2 -2
- package/dist/tools/functionalities/functionalities.d.ts +58 -1
- package/dist/tools/functionalities/generate-fiori-ui-app/command.d.ts +2 -2
- package/dist/tools/get-functionality-details.js +1 -1
- package/dist/tools/index.js +44 -10
- package/dist/tools/utils.d.ts +10 -0
- package/dist/tools/utils.js +49 -1
- package/dist/types/basic.d.ts +123 -0
- package/dist/types/basic.js +108 -0
- package/dist/types/index.d.ts +38 -0
- package/dist/{types.js → types/index.js} +1 -1
- package/dist/types/input.d.ts +29 -0
- package/dist/types/input.js +77 -0
- package/dist/types/output.d.ts +125 -0
- package/dist/types/output.js +97 -0
- package/package.json +11 -7
- package/dist/tools/input-schema/execute-functionality.json +0 -28
- package/dist/tools/input-schema/get-functionality-details.json +0 -24
- package/dist/tools/input-schema/index.d.ts +0 -5
- package/dist/tools/input-schema/index.js +0 -15
- package/dist/tools/input-schema/list-fiori-apps.json +0 -12
- package/dist/tools/input-schema/list-functionality.json +0 -10
- package/dist/tools/output-schema/execute-functionality.json +0 -39
- package/dist/tools/output-schema/get-functionality-details.json +0 -166
- package/dist/tools/output-schema/index.d.ts +0 -5
- package/dist/tools/output-schema/index.js +0 -15
- package/dist/tools/output-schema/list-fiori-apps.json +0 -41
- package/dist/tools/output-schema/list-functionality.json +0 -37
- package/dist/types.d.ts +0 -174
package/dist/server.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ export declare class FioriFunctionalityServer {
|
|
|
14
14
|
* Logs MCP errors and handles the SIGINT signal for graceful shutdown.
|
|
15
15
|
*/
|
|
16
16
|
private setupErrorHandling;
|
|
17
|
+
/**
|
|
18
|
+
* Sets up telemetry.
|
|
19
|
+
*/
|
|
20
|
+
private setupTelemetry;
|
|
17
21
|
/**
|
|
18
22
|
* Sets up handlers for various MCP tools.
|
|
19
23
|
* Configures handlers for listing tools, and calling specific Fiori functionality tools.
|
package/dist/server.js
CHANGED
|
@@ -10,6 +10,7 @@ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
|
10
10
|
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
11
11
|
const package_json_1 = __importDefault(require("../package.json"));
|
|
12
12
|
const tools_1 = require("./tools");
|
|
13
|
+
const telemetry_1 = require("./telemetry");
|
|
13
14
|
/**
|
|
14
15
|
* Sets up and manages an MCP (Model Context Protocol) server that provides Fiori-related tools.
|
|
15
16
|
*/
|
|
@@ -42,6 +43,12 @@ class FioriFunctionalityServer {
|
|
|
42
43
|
process.exit(0);
|
|
43
44
|
});
|
|
44
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Sets up telemetry.
|
|
48
|
+
*/
|
|
49
|
+
async setupTelemetry() {
|
|
50
|
+
await telemetry_1.TelemetryHelper.initTelemetrySettings();
|
|
51
|
+
}
|
|
45
52
|
/**
|
|
46
53
|
* Sets up handlers for various MCP tools.
|
|
47
54
|
* Configures handlers for listing tools, and calling specific Fiori functionality tools.
|
|
@@ -56,22 +63,30 @@ class FioriFunctionalityServer {
|
|
|
56
63
|
const { name, arguments: args } = request.params;
|
|
57
64
|
try {
|
|
58
65
|
let result;
|
|
66
|
+
telemetry_1.TelemetryHelper.markToolStartTime();
|
|
67
|
+
const telemetryProperties = {
|
|
68
|
+
tool: name,
|
|
69
|
+
functionalityId: args?.functionalityId
|
|
70
|
+
};
|
|
59
71
|
switch (name) {
|
|
60
72
|
case 'list-fiori-apps':
|
|
61
73
|
result = await (0, tools_1.listFioriApps)(args);
|
|
62
|
-
|
|
74
|
+
break;
|
|
63
75
|
case 'list-functionality':
|
|
64
76
|
result = await (0, tools_1.listFunctionalities)(args);
|
|
65
|
-
|
|
77
|
+
break;
|
|
66
78
|
case 'get-functionality-details':
|
|
67
79
|
result = await (0, tools_1.getFunctionalityDetails)(args);
|
|
68
|
-
|
|
80
|
+
break;
|
|
69
81
|
case 'execute-functionality':
|
|
70
82
|
result = await (0, tools_1.executeFunctionality)(args);
|
|
71
|
-
|
|
83
|
+
break;
|
|
72
84
|
default:
|
|
85
|
+
await telemetry_1.TelemetryHelper.sendTelemetry(telemetry_1.unknownTool, telemetryProperties, args?.appPath);
|
|
73
86
|
throw new Error(`Unknown tool: ${name}. Try one of: list-fiori-apps, list-functionality, get-functionality-details, execute-functionality.`);
|
|
74
87
|
}
|
|
88
|
+
await telemetry_1.TelemetryHelper.sendTelemetry(name, telemetryProperties, args?.appPath);
|
|
89
|
+
return this.convertResultToCallToolResult(result);
|
|
75
90
|
}
|
|
76
91
|
catch (error) {
|
|
77
92
|
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
@@ -113,6 +128,7 @@ class FioriFunctionalityServer {
|
|
|
113
128
|
async run() {
|
|
114
129
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
115
130
|
await this.server.connect(transport);
|
|
131
|
+
await this.setupTelemetry();
|
|
116
132
|
console.error('Fiori Functionality MCP Server running on stdio');
|
|
117
133
|
}
|
|
118
134
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type TelemetryProperties, type ToolsSuiteTelemetryInitSettings } from '@sap-ux/telemetry';
|
|
2
|
+
export declare const mcpServerName = "@sap-ux/fiori-mcp-server";
|
|
3
|
+
export declare const unknownTool = "unknown-tool";
|
|
4
|
+
export interface TelemetryData {
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Helper class for intialising and preparing event data for telemetry.
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class TelemetryHelper {
|
|
11
|
+
private static _telemetryData;
|
|
12
|
+
private static _previousEventTimestamp;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the telemetry data.
|
|
15
|
+
*
|
|
16
|
+
* @returns telemetry data
|
|
17
|
+
*/
|
|
18
|
+
static get telemetryData(): TelemetryData;
|
|
19
|
+
/**
|
|
20
|
+
* Load telemetry settings.
|
|
21
|
+
*
|
|
22
|
+
* @param options - tools suite telemetry init settings
|
|
23
|
+
*/
|
|
24
|
+
static initTelemetrySettings(options?: ToolsSuiteTelemetryInitSettings): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Creates telemetry data and adds default telemetry props.
|
|
27
|
+
*
|
|
28
|
+
* @param additionalData - set additional properties to be reported by telemetry
|
|
29
|
+
* @param filterDups - filters duplicates by returning undefined if it's suspected to be a repeated event based on previous telemetry data & timestamp (1 second)
|
|
30
|
+
* @returns telemetry data
|
|
31
|
+
*/
|
|
32
|
+
static createTelemetryData<T extends TelemetryProperties>(additionalData?: Partial<T>, filterDups?: boolean): TelemetryData | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Prepares the telemetry event by calculating the generation time if a mark name is provided.
|
|
35
|
+
*
|
|
36
|
+
* @param telemetryEventName - The name of the telemetry event
|
|
37
|
+
* @param telemetryData - The telemetry data
|
|
38
|
+
* @returns The prepared telemetry event
|
|
39
|
+
*/
|
|
40
|
+
private static prepareTelemetryEvent;
|
|
41
|
+
/**
|
|
42
|
+
* Marks the start time. Example usage:
|
|
43
|
+
* At the start of the MCP tool calling phase.
|
|
44
|
+
* It should not be updated everytime calling createTelemetryData().
|
|
45
|
+
*/
|
|
46
|
+
static markToolStartTime(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Marks the end time. Example usage:
|
|
49
|
+
* At the end of the writing phase of the MCP tool calling phase.
|
|
50
|
+
*/
|
|
51
|
+
static markToolsEndTime(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Sends the telemetry event to the telemetry client.
|
|
54
|
+
*
|
|
55
|
+
* @param telemetryEventName - the event name to be reported
|
|
56
|
+
* @param telemetryData - the telemetry data
|
|
57
|
+
* @param appPath - the path of the application
|
|
58
|
+
* @returns - a promise that resolves when the event is sent
|
|
59
|
+
*/
|
|
60
|
+
static sendTelemetry(telemetryEventName: string, telemetryData: TelemetryData, appPath?: string): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Gets the telemetry name of the module.
|
|
63
|
+
*
|
|
64
|
+
* @returns The module telemetry name.
|
|
65
|
+
*/
|
|
66
|
+
static getTelemetryName(): string;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TelemetryHelper = exports.unknownTool = exports.mcpServerName = void 0;
|
|
7
|
+
const telemetry_1 = require("@sap-ux/telemetry");
|
|
8
|
+
const feature_toggle_1 = require("@sap-ux/feature-toggle");
|
|
9
|
+
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
10
|
+
const os_name_1 = __importDefault(require("os-name"));
|
|
11
|
+
const i18next_1 = __importDefault(require("i18next"));
|
|
12
|
+
const package_json_1 = require("../../package.json");
|
|
13
|
+
exports.mcpServerName = '@sap-ux/fiori-mcp-server';
|
|
14
|
+
exports.unknownTool = 'unknown-tool';
|
|
15
|
+
const resourceId = '0a65e45d-6bf4-421d-b845-61e888c50e9e';
|
|
16
|
+
/**
|
|
17
|
+
* Helper class for intialising and preparing event data for telemetry.
|
|
18
|
+
*/
|
|
19
|
+
class TelemetryHelper {
|
|
20
|
+
static _telemetryData;
|
|
21
|
+
static _previousEventTimestamp;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the telemetry data.
|
|
24
|
+
*
|
|
25
|
+
* @returns telemetry data
|
|
26
|
+
*/
|
|
27
|
+
static get telemetryData() {
|
|
28
|
+
return this._telemetryData;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Load telemetry settings.
|
|
32
|
+
*
|
|
33
|
+
* @param options - tools suite telemetry init settings
|
|
34
|
+
*/
|
|
35
|
+
static async initTelemetrySettings(options) {
|
|
36
|
+
const telemetryOptions = {
|
|
37
|
+
consumerModule: {
|
|
38
|
+
name: exports.mcpServerName,
|
|
39
|
+
version: package_json_1.version
|
|
40
|
+
},
|
|
41
|
+
watchTelemetrySettingStore: false,
|
|
42
|
+
internalFeature: (0, feature_toggle_1.isInternalFeaturesSettingEnabled)(),
|
|
43
|
+
resourceId,
|
|
44
|
+
...options
|
|
45
|
+
};
|
|
46
|
+
await (0, telemetry_1.initTelemetrySettings)(telemetryOptions);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Creates telemetry data and adds default telemetry props.
|
|
50
|
+
*
|
|
51
|
+
* @param additionalData - set additional properties to be reported by telemetry
|
|
52
|
+
* @param filterDups - filters duplicates by returning undefined if it's suspected to be a repeated event based on previous telemetry data & timestamp (1 second)
|
|
53
|
+
* @returns telemetry data
|
|
54
|
+
*/
|
|
55
|
+
static createTelemetryData(additionalData, filterDups = false) {
|
|
56
|
+
const currentTimestamp = new Date().getTime();
|
|
57
|
+
if (!this._previousEventTimestamp) {
|
|
58
|
+
filterDups = false; // can't filter duplicates if no previous event timestamp
|
|
59
|
+
this._previousEventTimestamp = currentTimestamp;
|
|
60
|
+
}
|
|
61
|
+
if (!this._telemetryData) {
|
|
62
|
+
let osVersionName = i18next_1.default.t('telemetry.unknownOs');
|
|
63
|
+
try {
|
|
64
|
+
osVersionName = (0, os_name_1.default)();
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
// no matched os name, possible beta or unreleased version
|
|
68
|
+
}
|
|
69
|
+
this._telemetryData = {
|
|
70
|
+
Platform: (0, btp_utils_1.isAppStudio)() ? 'SBAS' : 'VSCode',
|
|
71
|
+
OperatingSystem: osVersionName
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (filterDups) {
|
|
75
|
+
const newTelemData = { ...this._telemetryData, ...additionalData };
|
|
76
|
+
if (Math.abs(this._previousEventTimestamp - currentTimestamp) < 1000 &&
|
|
77
|
+
JSON.stringify(newTelemData) === JSON.stringify(this._telemetryData)) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
this._previousEventTimestamp = currentTimestamp;
|
|
82
|
+
this._telemetryData = Object.assign(this._telemetryData, additionalData);
|
|
83
|
+
return this._telemetryData;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Prepares the telemetry event by calculating the generation time if a mark name is provided.
|
|
87
|
+
*
|
|
88
|
+
* @param telemetryEventName - The name of the telemetry event
|
|
89
|
+
* @param telemetryData - The telemetry data
|
|
90
|
+
* @returns The prepared telemetry event
|
|
91
|
+
*/
|
|
92
|
+
static prepareTelemetryEvent(telemetryEventName, telemetryData) {
|
|
93
|
+
// Make sure performance measurement end is called
|
|
94
|
+
this.markToolsEndTime();
|
|
95
|
+
const requestTime = telemetryData.markName
|
|
96
|
+
? telemetry_1.PerformanceMeasurementAPI.getMeasurementDuration(telemetryData.markName)
|
|
97
|
+
: undefined;
|
|
98
|
+
return {
|
|
99
|
+
eventName: telemetryEventName,
|
|
100
|
+
properties: telemetryData,
|
|
101
|
+
measurements: requestTime ? { RequestTime: requestTime } : {}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Marks the start time. Example usage:
|
|
106
|
+
* At the start of the MCP tool calling phase.
|
|
107
|
+
* It should not be updated everytime calling createTelemetryData().
|
|
108
|
+
*/
|
|
109
|
+
static markToolStartTime() {
|
|
110
|
+
this.createTelemetryData({
|
|
111
|
+
markName: telemetry_1.PerformanceMeasurementAPI.startMark('MCP_LOADING_TIME')
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Marks the end time. Example usage:
|
|
116
|
+
* At the end of the writing phase of the MCP tool calling phase.
|
|
117
|
+
*/
|
|
118
|
+
static markToolsEndTime() {
|
|
119
|
+
if (this._telemetryData?.markName) {
|
|
120
|
+
telemetry_1.PerformanceMeasurementAPI.endMark(this._telemetryData.markName);
|
|
121
|
+
telemetry_1.PerformanceMeasurementAPI.measure(this._telemetryData.markName);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Sends the telemetry event to the telemetry client.
|
|
126
|
+
*
|
|
127
|
+
* @param telemetryEventName - the event name to be reported
|
|
128
|
+
* @param telemetryData - the telemetry data
|
|
129
|
+
* @param appPath - the path of the application
|
|
130
|
+
* @returns - a promise that resolves when the event is sent
|
|
131
|
+
*/
|
|
132
|
+
static async sendTelemetry(telemetryEventName, telemetryData, appPath) {
|
|
133
|
+
const telemetryEvent = this.prepareTelemetryEvent(telemetryEventName, telemetryData);
|
|
134
|
+
await telemetry_1.ClientFactory.getTelemetryClient().reportEvent(telemetryEvent, telemetry_1.SampleRate.NoSampling, appPath ? { appPath } : undefined);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Gets the telemetry name of the module.
|
|
138
|
+
*
|
|
139
|
+
* @returns The module telemetry name.
|
|
140
|
+
*/
|
|
141
|
+
static getTelemetryName() {
|
|
142
|
+
return exports.mcpServerName;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.TelemetryHelper = TelemetryHelper;
|
|
146
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ExecuteFunctionalityInput, ExecuteFunctionalityOutput } from '../types';
|
|
2
2
|
import { PageEditorApi } from '../page-editor-api';
|
|
3
3
|
/**
|
|
4
4
|
* Executes a functionality based on the provided parameters.
|
|
@@ -7,7 +7,7 @@ import { PageEditorApi } from '../page-editor-api';
|
|
|
7
7
|
* @returns A promise that resolves to the execution output
|
|
8
8
|
* @throws Error if required parameters are missing
|
|
9
9
|
*/
|
|
10
|
-
export declare function executeFunctionality(params:
|
|
10
|
+
export declare function executeFunctionality(params: ExecuteFunctionalityInput): Promise<ExecuteFunctionalityOutput>;
|
|
11
11
|
/**
|
|
12
12
|
* Retrieves the PageEditorApi instance for the given application path and page name.
|
|
13
13
|
*
|
|
@@ -1,4 +1,61 @@
|
|
|
1
1
|
import type { FunctionalityHandlers } from '../../types';
|
|
2
|
-
export declare const FUNCTIONALITIES_DETAILS:
|
|
2
|
+
export declare const FUNCTIONALITIES_DETAILS: {
|
|
3
|
+
functionalityId: string | (string | number)[];
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
parameters: {
|
|
7
|
+
id: string;
|
|
8
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
9
|
+
name?: string | undefined;
|
|
10
|
+
required?: boolean | undefined;
|
|
11
|
+
description?: string | undefined;
|
|
12
|
+
defaultValue?: unknown;
|
|
13
|
+
options?: (string | number | boolean | null)[] | undefined;
|
|
14
|
+
currentValue?: unknown;
|
|
15
|
+
examples?: string[] | undefined;
|
|
16
|
+
pattern?: string | undefined;
|
|
17
|
+
parameters?: {
|
|
18
|
+
id: string;
|
|
19
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
20
|
+
name?: string | undefined;
|
|
21
|
+
required?: boolean | undefined;
|
|
22
|
+
description?: string | undefined;
|
|
23
|
+
defaultValue?: unknown;
|
|
24
|
+
options?: (string | number | boolean | null)[] | undefined;
|
|
25
|
+
currentValue?: unknown;
|
|
26
|
+
examples?: string[] | undefined;
|
|
27
|
+
pattern?: string | undefined;
|
|
28
|
+
parameters?: {
|
|
29
|
+
id: string;
|
|
30
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
31
|
+
name?: string | undefined;
|
|
32
|
+
required?: boolean | undefined;
|
|
33
|
+
description?: string | undefined;
|
|
34
|
+
defaultValue?: unknown;
|
|
35
|
+
options?: (string | number | boolean | null)[] | undefined;
|
|
36
|
+
currentValue?: unknown;
|
|
37
|
+
examples?: string[] | undefined;
|
|
38
|
+
pattern?: string | undefined;
|
|
39
|
+
parameters?: {
|
|
40
|
+
id: string;
|
|
41
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
42
|
+
name?: string | undefined;
|
|
43
|
+
required?: boolean | undefined;
|
|
44
|
+
description?: string | undefined;
|
|
45
|
+
defaultValue?: unknown;
|
|
46
|
+
options?: (string | number | boolean | null)[] | undefined;
|
|
47
|
+
currentValue?: unknown;
|
|
48
|
+
examples?: string[] | undefined;
|
|
49
|
+
pattern?: string | undefined;
|
|
50
|
+
}[] | undefined;
|
|
51
|
+
}[] | undefined;
|
|
52
|
+
}[] | undefined;
|
|
53
|
+
}[];
|
|
54
|
+
technicalDescription?: string | undefined;
|
|
55
|
+
prerequisites?: string[] | undefined;
|
|
56
|
+
impact?: string | undefined;
|
|
57
|
+
examples?: string[] | undefined;
|
|
58
|
+
pageName?: string | undefined;
|
|
59
|
+
}[];
|
|
3
60
|
export declare const FUNCTIONALITIES_HANDLERS: Map<string, FunctionalityHandlers>;
|
|
4
61
|
//# sourceMappingURL=functionalities.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ExecuteFunctionalityInput, ExecuteFunctionalityOutput } from '../../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Method to generate fiori app.
|
|
4
4
|
*
|
|
5
5
|
* @param params Input parameters for application generation.
|
|
6
6
|
* @returns Application generation execution output.
|
|
7
7
|
*/
|
|
8
|
-
export declare function command(params:
|
|
8
|
+
export declare function command(params: ExecuteFunctionalityInput): Promise<ExecuteFunctionalityOutput>;
|
|
9
9
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -54,7 +54,7 @@ function getParameters(properties) {
|
|
|
54
54
|
currentValue: property.value
|
|
55
55
|
};
|
|
56
56
|
if (property.options) {
|
|
57
|
-
parameter.options = property.options.map((option) => option.key);
|
|
57
|
+
parameter.options = property.options.map((option) => option.key ?? null);
|
|
58
58
|
}
|
|
59
59
|
if (property.properties) {
|
|
60
60
|
parameter.parameters = getParameters(property.properties);
|
package/dist/tools/index.js
CHANGED
|
@@ -1,8 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.tools = exports.executeFunctionality = exports.getFunctionalityDetails = exports.listFunctionalities = exports.listFioriApps = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
37
|
+
const Input = __importStar(require("../types/input"));
|
|
38
|
+
const Output = __importStar(require("../types/output"));
|
|
39
|
+
const utils_1 = require("./utils");
|
|
6
40
|
var list_fiori_apps_1 = require("./list-fiori-apps");
|
|
7
41
|
Object.defineProperty(exports, "listFioriApps", { enumerable: true, get: function () { return list_fiori_apps_1.listFioriApps; } });
|
|
8
42
|
var list_functionalities_1 = require("./list-functionalities");
|
|
@@ -18,8 +52,8 @@ exports.tools = [
|
|
|
18
52
|
This is an optional, preliminary tool.
|
|
19
53
|
**Use this first ONLY if the target application's name or path is not already known.**
|
|
20
54
|
The output can be used to ask the user for clarification before starting the main 3-step workflow.`,
|
|
21
|
-
inputSchema:
|
|
22
|
-
outputSchema:
|
|
55
|
+
inputSchema: (0, utils_1.convertToSchema)(Input.ListFioriAppsInputSchema),
|
|
56
|
+
outputSchema: (0, utils_1.convertToSchema)(Output.ListFioriAppsOutputSchema)
|
|
23
57
|
},
|
|
24
58
|
{
|
|
25
59
|
name: 'list-functionality',
|
|
@@ -30,8 +64,8 @@ exports.tools = [
|
|
|
30
64
|
You MUST not use a functionalityId as name of a tool.
|
|
31
65
|
Do not guess, assume, or use any functionality not present in this list, as it is invalid and will cause the operation to fail.
|
|
32
66
|
**Note: If the target application is not known, use the list-fiori-apps tool first to identify it.**`,
|
|
33
|
-
inputSchema:
|
|
34
|
-
outputSchema:
|
|
67
|
+
inputSchema: (0, utils_1.convertToSchema)(Input.ListFunctionalitiesInputSchema),
|
|
68
|
+
outputSchema: (0, utils_1.convertToSchema)(Output.ListFunctionalitiesOutputSchema)
|
|
35
69
|
},
|
|
36
70
|
{
|
|
37
71
|
name: 'get-functionality-details',
|
|
@@ -39,8 +73,8 @@ exports.tools = [
|
|
|
39
73
|
Gets the required parameters and detailed information for a specific functionality to create a new or modify an existing SAP Fiori application.
|
|
40
74
|
You MUST provide a functionalityId obtained from 'list-functionality' (Step 1).
|
|
41
75
|
The output of this tool is required for the final step 'execute-functionality' (Step 3).`,
|
|
42
|
-
inputSchema:
|
|
43
|
-
outputSchema:
|
|
76
|
+
inputSchema: (0, utils_1.convertToSchema)(Input.GetFunctionalityDetailsInputSchema),
|
|
77
|
+
outputSchema: (0, utils_1.convertToSchema)(Output.GetFunctionalityDetailsOutputSchema)
|
|
44
78
|
},
|
|
45
79
|
{
|
|
46
80
|
name: 'execute-functionality',
|
|
@@ -48,8 +82,8 @@ exports.tools = [
|
|
|
48
82
|
Executes a specific functionality to create a new or modify an existing SAP Fiori application with provided parameters.
|
|
49
83
|
This is the **final step** of the workflow and performs the actual creation or modification.
|
|
50
84
|
You MUST provide the exact parameter information obtained from get-functionality-details (Step 2).`,
|
|
51
|
-
inputSchema:
|
|
52
|
-
outputSchema:
|
|
85
|
+
inputSchema: (0, utils_1.convertToSchema)(Input.ExecuteFunctionalityInputSchema),
|
|
86
|
+
outputSchema: (0, utils_1.convertToSchema)(Output.ExecuteFunctionalityOutputSchema)
|
|
53
87
|
}
|
|
54
88
|
];
|
|
55
89
|
//# sourceMappingURL=index.js.map
|
package/dist/tools/utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as zod from 'zod';
|
|
1
2
|
import type { Appdetails } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* Resolves the application details from a given path.
|
|
@@ -13,4 +14,13 @@ export declare function resolveApplication(path: string): Promise<Appdetails | u
|
|
|
13
14
|
* @returns The relative path for the extension folder, or undefined if the directory type is not recognized.
|
|
14
15
|
*/
|
|
15
16
|
export declare const getDefaultExtensionFolder: (directory: string) => string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Converts a Zod schema into a JSON Schema object.
|
|
19
|
+
* Additionally function removes the `$schema` property (if present),
|
|
20
|
+
* since it is unnecessary for mcp server.
|
|
21
|
+
*
|
|
22
|
+
* @param schema - A Zod schema instance to be converted.
|
|
23
|
+
* @returns A JSON Schema object representing the given Zod schema.
|
|
24
|
+
*/
|
|
25
|
+
export declare const convertToSchema: (schema: zod.ZodType) => zod.core.JSONSchema.JSONSchema;
|
|
16
26
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/tools/utils.js
CHANGED
|
@@ -1,9 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDefaultExtensionFolder = void 0;
|
|
36
|
+
exports.convertToSchema = exports.getDefaultExtensionFolder = void 0;
|
|
4
37
|
exports.resolveApplication = resolveApplication;
|
|
5
38
|
const project_access_1 = require("@sap-ux/project-access");
|
|
6
39
|
const path_1 = require("path");
|
|
40
|
+
const zod = __importStar(require("zod"));
|
|
7
41
|
/**
|
|
8
42
|
* Resolves the application details from a given path.
|
|
9
43
|
*
|
|
@@ -71,4 +105,18 @@ const getDefaultExtensionFolder = (directory) => {
|
|
|
71
105
|
return subFolder;
|
|
72
106
|
};
|
|
73
107
|
exports.getDefaultExtensionFolder = getDefaultExtensionFolder;
|
|
108
|
+
/**
|
|
109
|
+
* Converts a Zod schema into a JSON Schema object.
|
|
110
|
+
* Additionally function removes the `$schema` property (if present),
|
|
111
|
+
* since it is unnecessary for mcp server.
|
|
112
|
+
*
|
|
113
|
+
* @param schema - A Zod schema instance to be converted.
|
|
114
|
+
* @returns A JSON Schema object representing the given Zod schema.
|
|
115
|
+
*/
|
|
116
|
+
const convertToSchema = (schema) => {
|
|
117
|
+
const jsonSchema = zod.toJSONSchema(schema);
|
|
118
|
+
delete jsonSchema.$schema;
|
|
119
|
+
return jsonSchema;
|
|
120
|
+
};
|
|
121
|
+
exports.convertToSchema = convertToSchema;
|
|
74
122
|
//# sourceMappingURL=utils.js.map
|