@jupiterone/jupiterone-mcp 0.3.0 → 0.4.0
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/mcp-server.d.ts.map +1 -1
- package/dist/server/mcp-server.js +1 -0
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/server/tools/account.d.ts.map +1 -1
- package/dist/server/tools/account.js +9 -8
- package/dist/server/tools/account.js.map +1 -1
- package/dist/server/tools/alerts.d.ts.map +1 -1
- package/dist/server/tools/alerts.js +34 -34
- package/dist/server/tools/alerts.js.map +1 -1
- package/dist/server/tools/dashboards.d.ts.map +1 -1
- package/dist/server/tools/dashboards.js +113 -104
- package/dist/server/tools/dashboards.js.map +1 -1
- package/dist/server/tools/integrations.d.ts.map +1 -1
- package/dist/server/tools/integrations.js +116 -128
- package/dist/server/tools/integrations.js.map +1 -1
- package/dist/server/tools/j1ql.d.ts.map +1 -1
- package/dist/server/tools/j1ql.js +23 -6
- package/dist/server/tools/j1ql.js.map +1 -1
- package/dist/server/tools/result.d.ts +14 -0
- package/dist/server/tools/result.d.ts.map +1 -0
- package/dist/server/tools/result.js +27 -0
- package/dist/server/tools/result.js.map +1 -0
- package/dist/server/tools/rules.d.ts.map +1 -1
- package/dist/server/tools/rules.js +203 -210
- package/dist/server/tools/rules.js.map +1 -1
- package/dist/server/tools/types.d.ts +4 -0
- package/dist/server/tools/types.d.ts.map +1 -1
- package/dist/server/tools/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.integrationTools = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const load_description_js_1 = require("../../utils/load-description.js");
|
|
6
|
+
const result_js_1 = require("./result.js");
|
|
6
7
|
const types_js_1 = require("./types.js");
|
|
8
|
+
// Items vary by integration provider, so rows stay open records; the top-level + pageInfo are
|
|
9
|
+
// documented. Permissive enough to never false-reject real data.
|
|
10
|
+
const pageInfo = zod_1.z.any().optional();
|
|
11
|
+
const definitionsOutput = { total: zod_1.z.number(), definitions: zod_1.z.array(zod_1.z.record(zod_1.z.any())), pageInfo };
|
|
12
|
+
const instancesOutput = { total: zod_1.z.number(), instances: zod_1.z.array(zod_1.z.record(zod_1.z.any())), pageInfo };
|
|
13
|
+
const jobsOutput = { total: zod_1.z.number(), jobs: zod_1.z.array(zod_1.z.record(zod_1.z.any())), pageInfo };
|
|
14
|
+
const eventsOutput = { events: zod_1.z.array(zod_1.z.record(zod_1.z.any())), pageInfo };
|
|
15
|
+
const jobOutput = {
|
|
16
|
+
id: zod_1.z.string().optional(),
|
|
17
|
+
status: zod_1.z.string().optional(),
|
|
18
|
+
integrationInstanceId: zod_1.z.string().optional(),
|
|
19
|
+
createDate: zod_1.z.any().optional(),
|
|
20
|
+
endDate: zod_1.z.any().optional(),
|
|
21
|
+
hasSkippedSteps: zod_1.z.boolean().optional(),
|
|
22
|
+
integrationInstance: zod_1.z.any().optional(),
|
|
23
|
+
integrationDefinition: zod_1.z.any().optional(),
|
|
24
|
+
};
|
|
7
25
|
exports.integrationTools = [
|
|
8
26
|
(0, types_js_1.defineTool)({
|
|
9
27
|
name: 'get-integration-definitions',
|
|
@@ -13,46 +31,40 @@ exports.integrationTools = [
|
|
|
13
31
|
cursor: zod_1.z.string().optional().describe('Optional cursor for pagination'),
|
|
14
32
|
includeConfig: zod_1.z.boolean().optional().describe('Whether to include configuration fields'),
|
|
15
33
|
},
|
|
34
|
+
outputSchema: definitionsOutput,
|
|
16
35
|
annotations: types_js_1.READ_ONLY,
|
|
17
36
|
errorContext: 'Error getting integration definitions',
|
|
18
37
|
handler: async ({ cursor, includeConfig }, client) => {
|
|
19
38
|
const definitions = await client.getIntegrationDefinitions(cursor, includeConfig);
|
|
20
|
-
return {
|
|
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
|
-
configSections: def.configSections,
|
|
50
|
-
})),
|
|
51
|
-
pageInfo: definitions.pageInfo,
|
|
52
|
-
}),
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
};
|
|
39
|
+
return (0, result_js_1.structuredResult)({
|
|
40
|
+
total: definitions.definitions.length,
|
|
41
|
+
definitions: definitions.definitions.map((def) => ({
|
|
42
|
+
id: def.id,
|
|
43
|
+
name: def.name,
|
|
44
|
+
type: def.type,
|
|
45
|
+
title: def.title,
|
|
46
|
+
displayMode: def.displayMode,
|
|
47
|
+
integrationType: def.integrationType,
|
|
48
|
+
integrationClass: def.integrationClass,
|
|
49
|
+
integrationCategory: def.integrationCategory,
|
|
50
|
+
beta: def.beta,
|
|
51
|
+
docsWebLink: def.docsWebLink,
|
|
52
|
+
repoWebLink: def.repoWebLink,
|
|
53
|
+
invocationPaused: def.invocationPaused,
|
|
54
|
+
managedExecutionDisabled: def.managedExecutionDisabled,
|
|
55
|
+
managedCreateDisabled: def.managedCreateDisabled,
|
|
56
|
+
managedDeleteDisabled: def.managedDeleteDisabled,
|
|
57
|
+
totalInstanceCount: def.totalInstanceCount,
|
|
58
|
+
description: def.description,
|
|
59
|
+
provisioningType: def.provisioningType,
|
|
60
|
+
customDefinitionType: def.customDefinitionType,
|
|
61
|
+
integrationPlatformFeatures: def.integrationPlatformFeatures,
|
|
62
|
+
configFields: def.configFields,
|
|
63
|
+
authSections: def.authSections,
|
|
64
|
+
configSections: def.configSections,
|
|
65
|
+
})),
|
|
66
|
+
pageInfo: definitions.pageInfo,
|
|
67
|
+
});
|
|
56
68
|
},
|
|
57
69
|
}),
|
|
58
70
|
(0, types_js_1.defineTool)({
|
|
@@ -72,45 +84,39 @@ exports.integrationTools = [
|
|
|
72
84
|
.optional()
|
|
73
85
|
.describe('Optional cursor for pagination; pass the endCursor from a previous response'),
|
|
74
86
|
},
|
|
87
|
+
outputSchema: instancesOutput,
|
|
75
88
|
annotations: types_js_1.READ_ONLY,
|
|
76
89
|
errorContext: 'Error getting integration instances',
|
|
77
90
|
handler: async ({ definitionId, limit, cursor }, client) => {
|
|
78
91
|
const instances = await client.getIntegrationInstances(definitionId, cursor, limit);
|
|
79
|
-
return {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
: null,
|
|
108
|
-
})),
|
|
109
|
-
pageInfo: instances.pageInfo,
|
|
110
|
-
}),
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
};
|
|
92
|
+
return (0, result_js_1.structuredResult)({
|
|
93
|
+
total: instances.instances.length,
|
|
94
|
+
instances: instances.instances.map((instance) => ({
|
|
95
|
+
id: instance.id,
|
|
96
|
+
name: instance.name,
|
|
97
|
+
accountId: instance.accountId,
|
|
98
|
+
sourceIntegrationInstanceId: instance.sourceIntegrationInstanceId,
|
|
99
|
+
pollingInterval: instance.pollingInterval,
|
|
100
|
+
pollingIntervalCronExpression: instance.pollingIntervalCronExpression,
|
|
101
|
+
integrationDefinitionId: instance.integrationDefinitionId,
|
|
102
|
+
description: instance.description,
|
|
103
|
+
config: instance.config,
|
|
104
|
+
instanceRelationship: instance.instanceRelationship,
|
|
105
|
+
resourceGroupId: instance.resourceGroupId,
|
|
106
|
+
createdOn: instance.createdOn,
|
|
107
|
+
createdBy: instance.createdBy,
|
|
108
|
+
updatedOn: instance.updatedOn,
|
|
109
|
+
updatedBy: instance.updatedBy,
|
|
110
|
+
mostRecentJob: instance.mostRecentJob
|
|
111
|
+
? {
|
|
112
|
+
status: instance.mostRecentJob.status,
|
|
113
|
+
hasSkippedSteps: instance.mostRecentJob.hasSkippedSteps,
|
|
114
|
+
createDate: instance.mostRecentJob.createDate,
|
|
115
|
+
}
|
|
116
|
+
: null,
|
|
117
|
+
})),
|
|
118
|
+
pageInfo: instances.pageInfo,
|
|
119
|
+
});
|
|
114
120
|
},
|
|
115
121
|
}),
|
|
116
122
|
(0, types_js_1.defineTool)({
|
|
@@ -142,31 +148,25 @@ exports.integrationTools = [
|
|
|
142
148
|
.optional()
|
|
143
149
|
.describe('Optional cursor for pagination; pass the endCursor from a previous response'),
|
|
144
150
|
},
|
|
151
|
+
outputSchema: jobsOutput,
|
|
145
152
|
annotations: types_js_1.READ_ONLY,
|
|
146
153
|
errorContext: 'Error getting integration jobs',
|
|
147
154
|
handler: async ({ status, integrationInstanceId, integrationDefinitionId, integrationInstanceIds, size, cursor }, client) => {
|
|
148
155
|
const jobs = await client.getIntegrationJobs(status, integrationInstanceId, integrationDefinitionId, integrationInstanceIds, cursor, size);
|
|
149
|
-
return {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
integrationDefinition: job.integrationDefinition,
|
|
164
|
-
})),
|
|
165
|
-
pageInfo: jobs.pageInfo,
|
|
166
|
-
}),
|
|
167
|
-
},
|
|
168
|
-
],
|
|
169
|
-
};
|
|
156
|
+
return (0, result_js_1.structuredResult)({
|
|
157
|
+
total: jobs.jobs.length,
|
|
158
|
+
jobs: jobs.jobs.map((job) => ({
|
|
159
|
+
id: job.id,
|
|
160
|
+
status: job.status,
|
|
161
|
+
integrationInstanceId: job.integrationInstanceId,
|
|
162
|
+
createDate: job.createDate,
|
|
163
|
+
endDate: job.endDate,
|
|
164
|
+
hasSkippedSteps: job.hasSkippedSteps,
|
|
165
|
+
integrationInstance: job.integrationInstance,
|
|
166
|
+
integrationDefinition: job.integrationDefinition,
|
|
167
|
+
})),
|
|
168
|
+
pageInfo: jobs.pageInfo,
|
|
169
|
+
});
|
|
170
170
|
},
|
|
171
171
|
}),
|
|
172
172
|
(0, types_js_1.defineTool)({
|
|
@@ -177,27 +177,21 @@ exports.integrationTools = [
|
|
|
177
177
|
integrationJobId: zod_1.z.string().describe('ID of the job to get'),
|
|
178
178
|
integrationInstanceId: zod_1.z.string().describe('ID of the instance the job belongs to'),
|
|
179
179
|
},
|
|
180
|
+
outputSchema: jobOutput,
|
|
180
181
|
annotations: types_js_1.READ_ONLY,
|
|
181
182
|
errorContext: 'Error',
|
|
182
183
|
handler: async ({ integrationJobId, integrationInstanceId }, client) => {
|
|
183
184
|
const job = await client.getIntegrationJob(integrationJobId, integrationInstanceId);
|
|
184
|
-
return {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
hasSkippedSteps: job.hasSkippedSteps,
|
|
195
|
-
integrationInstance: job.integrationInstance,
|
|
196
|
-
integrationDefinition: job.integrationDefinition,
|
|
197
|
-
}),
|
|
198
|
-
},
|
|
199
|
-
],
|
|
200
|
-
};
|
|
185
|
+
return (0, result_js_1.structuredResult)({
|
|
186
|
+
id: job.id,
|
|
187
|
+
status: job.status,
|
|
188
|
+
integrationInstanceId: job.integrationInstanceId,
|
|
189
|
+
createDate: job.createDate,
|
|
190
|
+
endDate: job.endDate,
|
|
191
|
+
hasSkippedSteps: job.hasSkippedSteps,
|
|
192
|
+
integrationInstance: job.integrationInstance,
|
|
193
|
+
integrationDefinition: job.integrationDefinition,
|
|
194
|
+
});
|
|
201
195
|
},
|
|
202
196
|
}),
|
|
203
197
|
(0, types_js_1.defineTool)({
|
|
@@ -215,29 +209,23 @@ exports.integrationTools = [
|
|
|
215
209
|
.optional()
|
|
216
210
|
.describe('Optional size limit for number of events to return (1-1000)'),
|
|
217
211
|
},
|
|
212
|
+
outputSchema: eventsOutput,
|
|
218
213
|
annotations: types_js_1.READ_ONLY,
|
|
219
214
|
errorContext: 'Error',
|
|
220
215
|
handler: async ({ jobId, integrationInstanceId, cursor, size }, client) => {
|
|
221
216
|
const events = await client.getIntegrationEvents(jobId, integrationInstanceId, cursor, size);
|
|
222
|
-
return {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
eventCode: event.eventCode,
|
|
235
|
-
})),
|
|
236
|
-
pageInfo: events.pageInfo,
|
|
237
|
-
}),
|
|
238
|
-
},
|
|
239
|
-
],
|
|
240
|
-
};
|
|
217
|
+
return (0, result_js_1.structuredResult)({
|
|
218
|
+
events: events.events.map((event) => ({
|
|
219
|
+
id: event.id,
|
|
220
|
+
name: event.name,
|
|
221
|
+
description: event.description,
|
|
222
|
+
createDate: event.createDate,
|
|
223
|
+
jobId: event.jobId,
|
|
224
|
+
level: event.level,
|
|
225
|
+
eventCode: event.eventCode,
|
|
226
|
+
})),
|
|
227
|
+
pageInfo: events.pageInfo,
|
|
228
|
+
});
|
|
241
229
|
},
|
|
242
230
|
}),
|
|
243
231
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrations.js","sourceRoot":"","sources":["../../../src/server/tools/integrations.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,yEAAkE;AAClE,yCAAwE;
|
|
1
|
+
{"version":3,"file":"integrations.js","sour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AO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE;YACxE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;YAC7F,OAAO,IAAA,4BAAgB,EAAC;gBACtB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;oBACpC,EAAE,EAAE,KAAK,CAAC,EAAE;oBACZ,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,WAAW,EAAE,KAAK,CAAC,WAAW;oBAC9B,UAAU,EAAE,KAAK,CAAC,UAAU;oBAC5B,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,SAAS,EAAE,KAAK,CAAC,SAAS;iBAC3B,CAAC,CAAC;gBACH,QAAQ,EAAE,MAAM,CAAC,QAAQ;aAC1B,CAAC,CAAC;QACL,CAAC;KACF,CAAC;CACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"j1ql.d.ts","sourceRoot":"","sources":["../../../src/server/tools/j1ql.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"j1ql.d.ts","sourceRoot":"","sources":["../../../src/server/tools/j1ql.ts"],"names":[],"mappings":"AAIA,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAsBxE,eAAO,MAAM,SAAS,EAAE,cAAc,EA6DrC,CAAC"}
|
|
@@ -4,7 +4,26 @@ exports.j1qlTools = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const load_description_js_1 = require("../../utils/load-description.js");
|
|
6
6
|
const errors_js_1 = require("./errors.js");
|
|
7
|
+
const result_js_1 = require("./result.js");
|
|
7
8
|
const types_js_1 = require("./types.js");
|
|
9
|
+
// J1QL output is highly variable: `data` rows carry open `entity`/`properties`, and the envelope
|
|
10
|
+
// shape differs by query type. Every field is optional and rows are open so real results never
|
|
11
|
+
// false-reject; the schema documents the shape and exposes the typed object for code-mode / UI.
|
|
12
|
+
const executeJ1qlOutput = {
|
|
13
|
+
correlationId: zod_1.z.string().optional(),
|
|
14
|
+
status: zod_1.z.string().optional(),
|
|
15
|
+
query: zod_1.z.string().optional(),
|
|
16
|
+
duration: zod_1.z.number().optional(),
|
|
17
|
+
url: zod_1.z.string().optional(),
|
|
18
|
+
type: zod_1.z.string().optional(),
|
|
19
|
+
data: zod_1.z.array(zod_1.z.any()).optional(),
|
|
20
|
+
cursor: zod_1.z.string().optional(),
|
|
21
|
+
messages: zod_1.z.array(zod_1.z.any()).optional(),
|
|
22
|
+
};
|
|
23
|
+
const listEntityTypesOutput = {
|
|
24
|
+
classes: zod_1.z.record(zod_1.z.any()).optional(),
|
|
25
|
+
types: zod_1.z.record(zod_1.z.any()).optional(),
|
|
26
|
+
};
|
|
8
27
|
exports.j1qlTools = [
|
|
9
28
|
(0, types_js_1.defineTool)({
|
|
10
29
|
name: 'execute-j1ql-query',
|
|
@@ -31,6 +50,7 @@ exports.j1qlTools = [
|
|
|
31
50
|
.describe('Array of filters that define the desired vertex'),
|
|
32
51
|
},
|
|
33
52
|
annotations: types_js_1.READ_ONLY,
|
|
53
|
+
outputSchema: executeJ1qlOutput,
|
|
34
54
|
errorContext: 'Error executing J1QL query',
|
|
35
55
|
formatError: (error, { query }, validator) => (0, errors_js_1.createQueryErrorResponse)(error, query, validator),
|
|
36
56
|
handler: async ({ query, variables, cursor, includeDeleted, flags, scopeFilters }, client) => {
|
|
@@ -46,9 +66,7 @@ exports.j1qlTools = [
|
|
|
46
66
|
});
|
|
47
67
|
const accountInfo = await client.getAccountInfo();
|
|
48
68
|
const queryUrl = client.j1qlService.constructQueryUrl(query, accountInfo.subdomain);
|
|
49
|
-
return {
|
|
50
|
-
content: [{ type: 'text', text: JSON.stringify({ ...result, url: queryUrl }) }],
|
|
51
|
-
};
|
|
69
|
+
return (0, result_js_1.structuredResult)({ ...result, url: queryUrl });
|
|
52
70
|
},
|
|
53
71
|
}),
|
|
54
72
|
(0, types_js_1.defineTool)({
|
|
@@ -56,13 +74,12 @@ exports.j1qlTools = [
|
|
|
56
74
|
title: 'List Entity Types',
|
|
57
75
|
description: (0, load_description_js_1.loadDescription)('list-entity-types.md'),
|
|
58
76
|
inputSchema: {},
|
|
77
|
+
outputSchema: listEntityTypesOutput,
|
|
59
78
|
annotations: types_js_1.READ_ONLY,
|
|
60
79
|
errorContext: 'Error listing entity types',
|
|
61
80
|
handler: async (_params, client) => {
|
|
62
81
|
const results = await client.listEntityTypes();
|
|
63
|
-
return
|
|
64
|
-
content: [{ type: 'text', text: JSON.stringify(results) }],
|
|
65
|
-
};
|
|
82
|
+
return (0, result_js_1.structuredResult)(results);
|
|
66
83
|
},
|
|
67
84
|
}),
|
|
68
85
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"j1ql.js","sourceRoot":"","sources":["../../../src/server/tools/j1ql.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,yEAAkE;AAClE,2CAAuD;AACvD,yCAAwE;
|
|
1
|
+
{"version":3,"file":"j1ql.js","sourceRoot":"","sources":["../../../src/server/tools/j1ql.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,yEAAkE;AAClE,2CAAuD;AACvD,2CAA+C;AAC/C,yCAAwE;AAExE,iGAAiG;AACjG,+FAA+F;AAC/F,gGAAgG;AAChG,MAAM,iBAAiB,GAAG;IACxB,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,QAAQ,EAAE,OAAC,CAAC,MAAM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AE,QAAQ,EAAE,CAAC,CAAC;QACxD,CAAC;KACF,CAAC;IAEF,IAAA,qBAAU,EAAC;QACT,IAAI,EAAE,mBAAmB;QACzB,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EAAE,IAAA,qCAAe,EAAC,sBAAsB,CAAC;QACpD,WAAW,EAAE,EAAE;QACf,YAAY,EAAE,qBAAqB;QACnC,WAAW,EAAE,oBAAS;QACtB,YAAY,EAAE,4BAA4B;QAC1C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YACjC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,eAAe,EAAE,CAAC;YAC/C,OAAO,IAAA,4BAAgB,EAAC,OAAO,CAAC,CAAC;QACnC,CAAC;KACF,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ToolResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Builds a success result with both channels (P1):
|
|
4
|
+
* - `structuredContent`: the typed payload — for code-mode consumers and future MCP Apps UI
|
|
5
|
+
* (it becomes the UI's data prop), validated against the tool's outputSchema by the SDK.
|
|
6
|
+
* - `content`: the same payload as JSON text — the model-facing and text-only-host fallback the
|
|
7
|
+
* spec requires ("tools MUST return a meaningful content array even when UI is available").
|
|
8
|
+
*
|
|
9
|
+
* The two channels are semantically equivalent (per SEP-1624); clients choose which to forward to
|
|
10
|
+
* the model. Error paths do NOT use this — they return content-only `isError` results, which the
|
|
11
|
+
* SDK exempts from output-schema validation.
|
|
12
|
+
*/
|
|
13
|
+
export declare function structuredResult(payload: Record<string, unknown>): ToolResult;
|
|
14
|
+
//# sourceMappingURL=result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../../src/server/tools/result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAW7E"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.structuredResult = structuredResult;
|
|
4
|
+
/**
|
|
5
|
+
* Builds a success result with both channels (P1):
|
|
6
|
+
* - `structuredContent`: the typed payload — for code-mode consumers and future MCP Apps UI
|
|
7
|
+
* (it becomes the UI's data prop), validated against the tool's outputSchema by the SDK.
|
|
8
|
+
* - `content`: the same payload as JSON text — the model-facing and text-only-host fallback the
|
|
9
|
+
* spec requires ("tools MUST return a meaningful content array even when UI is available").
|
|
10
|
+
*
|
|
11
|
+
* The two channels are semantically equivalent (per SEP-1624); clients choose which to forward to
|
|
12
|
+
* the model. Error paths do NOT use this — they return content-only `isError` results, which the
|
|
13
|
+
* SDK exempts from output-schema validation.
|
|
14
|
+
*/
|
|
15
|
+
function structuredResult(payload) {
|
|
16
|
+
// Normalize once through JSON so the two channels are byte-identical and free of `undefined`
|
|
17
|
+
// (which JSON.stringify drops and JSON Schema can't represent). Building payloads from optional
|
|
18
|
+
// API fields commonly leaves keys `undefined`; without this, `content` would omit them while
|
|
19
|
+
// `structuredContent` kept them, diverging the channels and risking outputSchema validation
|
|
20
|
+
// failures.
|
|
21
|
+
const text = JSON.stringify(payload);
|
|
22
|
+
return {
|
|
23
|
+
content: [{ type: 'text', text }],
|
|
24
|
+
structuredContent: JSON.parse(text),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../../src/server/tools/result.ts"],"names":[],"mappings":";;AAaA,4CAWC;AAtBD;;;;;;;;;;GAUG;AACH,SAAgB,gBAAgB,CAAC,OAAgC;IAC/D,6FAA6F;IAC7F,gGAAgG;IAChG,6FAA6F;IAC7F,4FAA4F;IAC5F,YAAY;IACZ,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QACjC,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;KACpC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../src/server/tools/rules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../src/server/tools/rules.ts"],"names":[],"mappings":"AAYA,OAAO,EAAyC,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAyIxF,eAAO,MAAM,SAAS,EAAE,cAAc,EAoarC,CAAC"}
|