@cloudinary/asset-management-mcp 0.8.1 → 0.9.0-rc.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/README.md +2 -2
- package/bin/mcp-server.js +4849 -305
- package/bin/mcp-server.js.map +25 -21
- package/esm/landing-page.js +1 -1
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/lib/config.js.map +1 -1
- package/esm/lib/encodings.d.ts +1 -0
- package/esm/lib/encodings.d.ts.map +1 -1
- package/esm/lib/encodings.js +26 -5
- package/esm/lib/encodings.js.map +1 -1
- package/esm/lib/security.d.ts +1 -1
- package/esm/lib/security.d.ts.map +1 -1
- package/esm/lib/security.js +29 -17
- package/esm/lib/security.js.map +1 -1
- package/esm/mcp-server/mcp-server.js +1 -1
- package/esm/mcp-server/mcp-server.js.map +1 -1
- package/esm/mcp-server/server.extensions.d.ts.map +1 -1
- package/esm/mcp-server/server.extensions.js +84 -0
- package/esm/mcp-server/server.extensions.js.map +1 -1
- package/esm/mcp-server/server.js +1 -1
- package/esm/mcp-server/server.js.map +1 -1
- package/esm/mcp-server/tools/assetsGetResourceByAssetId.d.ts.map +1 -1
- package/esm/mcp-server/tools/assetsGetResourceByAssetId.js +4 -0
- package/esm/mcp-server/tools/assetsGetResourceByAssetId.js.map +1 -1
- package/esm/mcp-server/tools/assetsListImages.d.ts +1 -1
- package/esm/mcp-server/tools/assetsListImages.d.ts.map +1 -1
- package/esm/mcp-server/tools/assetsListImages.js +4 -0
- package/esm/mcp-server/tools/assetsListImages.js.map +1 -1
- package/esm/mcp-server/tools/assetsListRawFiles.d.ts +1 -1
- package/esm/mcp-server/tools/assetsListRawFiles.d.ts.map +1 -1
- package/esm/mcp-server/tools/assetsListRawFiles.js +4 -0
- package/esm/mcp-server/tools/assetsListRawFiles.js.map +1 -1
- package/esm/mcp-server/tools/assetsListVideos.d.ts +1 -1
- package/esm/mcp-server/tools/assetsListVideos.d.ts.map +1 -1
- package/esm/mcp-server/tools/assetsListVideos.js +4 -0
- package/esm/mcp-server/tools/assetsListVideos.js.map +1 -1
- package/esm/mcp-server/tools/searchSearchAssets.d.ts.map +1 -1
- package/esm/mcp-server/tools/searchSearchAssets.js +4 -0
- package/esm/mcp-server/tools/searchSearchAssets.js.map +1 -1
- package/esm/mcp-server/tools/uploadUpload.d.ts.map +1 -1
- package/esm/mcp-server/tools/uploadUpload.js +4 -0
- package/esm/mcp-server/tools/uploadUpload.js.map +1 -1
- package/esm/mcp-server/tools.d.ts +2 -0
- package/esm/mcp-server/tools.d.ts.map +1 -1
- package/esm/mcp-server/tools.js +2 -0
- package/esm/mcp-server/tools.js.map +1 -1
- package/esm/mcp-server/widgets/asset-details-widget.d.ts +3 -0
- package/esm/mcp-server/widgets/asset-details-widget.d.ts.map +1 -0
- package/esm/mcp-server/widgets/asset-details-widget.js +299 -0
- package/esm/mcp-server/widgets/asset-details-widget.js.map +1 -0
- package/esm/mcp-server/widgets/asset-gallery-widget.d.ts +4 -0
- package/esm/mcp-server/widgets/asset-gallery-widget.d.ts.map +1 -0
- package/esm/mcp-server/widgets/asset-gallery-widget.js +1063 -0
- package/esm/mcp-server/widgets/asset-gallery-widget.js.map +1 -0
- package/esm/mcp-server/widgets/asset-upload-widget.d.ts +3 -0
- package/esm/mcp-server/widgets/asset-upload-widget.d.ts.map +1 -0
- package/esm/mcp-server/widgets/asset-upload-widget.js +1093 -0
- package/esm/mcp-server/widgets/asset-upload-widget.js.map +1 -0
- package/esm/mcp-server/widgets/widget-shared.d.ts +9 -0
- package/esm/mcp-server/widgets/widget-shared.d.ts.map +1 -0
- package/esm/mcp-server/widgets/widget-shared.js +2019 -0
- package/esm/mcp-server/widgets/widget-shared.js.map +1 -0
- package/esm/models/fieldsspec.d.ts +1 -1
- package/package.json +1 -1
- package/src/landing-page.ts +1 -1
- package/src/lib/config.ts +3 -3
- package/src/lib/encodings.ts +32 -4
- package/src/lib/security.ts +14 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.extensions.ts +97 -0
- package/src/mcp-server/server.ts +1 -1
- package/src/mcp-server/tools/assetsGetResourceByAssetId.ts +4 -0
- package/src/mcp-server/tools/assetsListImages.ts +4 -0
- package/src/mcp-server/tools/assetsListRawFiles.ts +4 -0
- package/src/mcp-server/tools/assetsListVideos.ts +4 -0
- package/src/mcp-server/tools/searchSearchAssets.ts +4 -0
- package/src/mcp-server/tools/uploadUpload.ts +4 -0
- package/src/mcp-server/tools.ts +4 -0
- package/src/mcp-server/widgets/asset-details-widget.ts +313 -0
- package/src/mcp-server/widgets/asset-gallery-widget.ts +1077 -0
- package/src/mcp-server/widgets/asset-upload-widget.ts +1115 -0
- package/src/mcp-server/widgets/widget-shared.ts +2030 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget-shared.js","sourceRoot":"","sources":["../../../src/mcp-server/widgets/widget-shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,uEAAuE;AACvE,SAAS,yBAAyB,CAChC,MAA+B;IAE/B,MAAM,KAAK,GAAI,MAAmD;SAC/D,UAAU,IAAI,EAAE,CAAC;IACpB,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAChD,MAAM,CAAC,GAAG,IAAuC,CAAC;QAClD,IAAI,CAAC,EAAE,WAAW;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC;IAClD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,WAAW,GAAG,YAAY,CAAC,cAAc,E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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAs5BlD,CAAC;AAEF,uEAAuE;AACvE,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0F9C,CAAC;AAEF,+EAA+E;AAC/E,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,oBAAoB,gBAAgB;;;;;;;;CAQ9E,CAAC"}
|
|
@@ -35,13 +35,13 @@ export declare const FieldsSpec$zodSchema: z.ZodEnum<{
|
|
|
35
35
|
metadata: "metadata";
|
|
36
36
|
format: "format";
|
|
37
37
|
status: "status";
|
|
38
|
+
bytes: "bytes";
|
|
38
39
|
context: "context";
|
|
39
40
|
resource_type: "resource_type";
|
|
40
41
|
version_id: "version_id";
|
|
41
42
|
signature: "signature";
|
|
42
43
|
width: "width";
|
|
43
44
|
height: "height";
|
|
44
|
-
bytes: "bytes";
|
|
45
45
|
secure_url: "secure_url";
|
|
46
46
|
version: "version";
|
|
47
47
|
created_at: "created_at";
|
package/package.json
CHANGED
package/src/landing-page.ts
CHANGED
|
@@ -933,7 +933,7 @@ http_headers = { "api-key" = "YOUR_API_KEY", "api-secret" = "YOUR_API_SECRET", "
|
|
|
933
933
|
<h1>Instructions</h1>
|
|
934
934
|
<p>One-click installation for Claude Desktop users</p>
|
|
935
935
|
<div class="instruction-item">
|
|
936
|
-
<a href="https://github.com/cloudinary/asset-management-mcp/releases/download/v0.
|
|
936
|
+
<a href="https://github.com/cloudinary/asset-management-mcp/releases/download/v0.9.0-rc.0/mcp-server.mcpb" download="mcp-server.mcpb" class="action-button header-action" style="display: inline-flex; margin-bottom: 16px;">
|
|
937
937
|
📥 Download MCP Bundle
|
|
938
938
|
</a>
|
|
939
939
|
</div>
|
package/src/lib/config.ts
CHANGED
|
@@ -113,8 +113,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
113
113
|
export const SDK_METADATA = {
|
|
114
114
|
language: "typescript",
|
|
115
115
|
openapiDocVersion: "0.4.0",
|
|
116
|
-
sdkVersion: "0.
|
|
117
|
-
genVersion: "2.
|
|
116
|
+
sdkVersion: "0.9.0-rc.0",
|
|
117
|
+
genVersion: "2.879.11",
|
|
118
118
|
userAgent:
|
|
119
|
-
"speakeasy-sdk/mcp-typescript 0.
|
|
119
|
+
"speakeasy-sdk/mcp-typescript 0.9.0-rc.0 2.879.11 0.4.0 @cloudinary/asset-management-mcp",
|
|
120
120
|
} as const;
|
package/src/lib/encodings.ts
CHANGED
|
@@ -475,6 +475,23 @@ export const encodeSpaceDelimitedQuery = queryEncoder(encodeSpaceDelimited);
|
|
|
475
475
|
export const encodePipeDelimitedQuery = queryEncoder(encodePipeDelimited);
|
|
476
476
|
export const encodeDeepObjectQuery = queryEncoder(encodeDeepObject);
|
|
477
477
|
|
|
478
|
+
function isBlobLike(val: unknown): val is Blob {
|
|
479
|
+
if (val instanceof Blob) {
|
|
480
|
+
return true;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
if (typeof val !== "object" || val == null || !(Symbol.toStringTag in val)) {
|
|
484
|
+
return false;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
const tag = val[Symbol.toStringTag];
|
|
488
|
+
if (tag !== "Blob" && tag !== "File") {
|
|
489
|
+
return false;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
return "stream" in val && typeof val.stream === "function";
|
|
493
|
+
}
|
|
494
|
+
|
|
478
495
|
export function appendForm(
|
|
479
496
|
fd: FormData,
|
|
480
497
|
key: string,
|
|
@@ -483,11 +500,22 @@ export function appendForm(
|
|
|
483
500
|
): void {
|
|
484
501
|
if (value == null) {
|
|
485
502
|
return;
|
|
486
|
-
} else if (value
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
503
|
+
} else if (isBlobLike(value)) {
|
|
504
|
+
if (fileName) {
|
|
505
|
+
fd.append(key, value as Blob, fileName);
|
|
506
|
+
} else {
|
|
507
|
+
fd.append(key, value as Blob);
|
|
508
|
+
}
|
|
490
509
|
} else {
|
|
491
510
|
fd.append(key, String(value));
|
|
492
511
|
}
|
|
493
512
|
}
|
|
513
|
+
|
|
514
|
+
export async function normalizeBlob(
|
|
515
|
+
value: Pick<Blob, "arrayBuffer" | "type">,
|
|
516
|
+
): Promise<Blob> {
|
|
517
|
+
if (value instanceof Blob) {
|
|
518
|
+
return value;
|
|
519
|
+
}
|
|
520
|
+
return new Blob([await value.arrayBuffer()], { type: value.type });
|
|
521
|
+
}
|
package/src/lib/security.ts
CHANGED
|
@@ -241,8 +241,9 @@ function applyBearer(
|
|
|
241
241
|
}
|
|
242
242
|
export function resolveGlobalSecurity(
|
|
243
243
|
security: Partial<Security> | null | undefined,
|
|
244
|
+
allowedFields?: number[],
|
|
244
245
|
): SecurityState | null {
|
|
245
|
-
|
|
246
|
+
let inputs: SecurityInput[][] = [
|
|
246
247
|
[
|
|
247
248
|
{
|
|
248
249
|
type: "http:custom",
|
|
@@ -261,7 +262,18 @@ export function resolveGlobalSecurity(
|
|
|
261
262
|
value: security?.oauth2 || env().CLOUDINARY_OAUTH2,
|
|
262
263
|
},
|
|
263
264
|
],
|
|
264
|
-
|
|
265
|
+
];
|
|
266
|
+
|
|
267
|
+
if (allowedFields) {
|
|
268
|
+
inputs = allowedFields.map((i) => {
|
|
269
|
+
if (i < 0 || i >= inputs.length) {
|
|
270
|
+
throw new RangeError(`invalid allowedFields index ${i}`);
|
|
271
|
+
}
|
|
272
|
+
return inputs[i]!;
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return resolveSecurity(...inputs);
|
|
265
277
|
}
|
|
266
278
|
|
|
267
279
|
export async function extractSecurity<
|
|
@@ -7,6 +7,19 @@ import { Register } from "./extensions.js";
|
|
|
7
7
|
import { formatResult } from "./tools.js";
|
|
8
8
|
import { assetsExplicitAsset } from "../funcs/assetsExplicitAsset.js";
|
|
9
9
|
import { ResourceType$zodSchema } from "../models/resourcetype.js";
|
|
10
|
+
import {
|
|
11
|
+
ASSET_GALLERY_RESOURCE_URI,
|
|
12
|
+
MCP_APP_MIME_TYPE,
|
|
13
|
+
getAssetGalleryHtml,
|
|
14
|
+
} from "./widgets/asset-gallery-widget.js";
|
|
15
|
+
import {
|
|
16
|
+
ASSET_DETAILS_RESOURCE_URI,
|
|
17
|
+
getAssetDetailsHtml,
|
|
18
|
+
} from "./widgets/asset-details-widget.js";
|
|
19
|
+
import {
|
|
20
|
+
ASSET_UPLOAD_RESOURCE_URI,
|
|
21
|
+
getAssetUploadHtml,
|
|
22
|
+
} from "./widgets/asset-upload-widget.js";
|
|
10
23
|
|
|
11
24
|
const TX_RULES_URL = "https://cloudinary.com/documentation/cloudinary_transformation_rules.md";
|
|
12
25
|
|
|
@@ -55,6 +68,90 @@ export function registerMCPExtensions(register: Register): void {
|
|
|
55
68
|
}
|
|
56
69
|
});
|
|
57
70
|
|
|
71
|
+
// Asset gallery MCP App — interactive UI for list-images results
|
|
72
|
+
register.resource({
|
|
73
|
+
name: "Asset Gallery Widget",
|
|
74
|
+
description: "Interactive asset gallery for browsing Cloudinary images",
|
|
75
|
+
metadata: {
|
|
76
|
+
mimeType: MCP_APP_MIME_TYPE,
|
|
77
|
+
},
|
|
78
|
+
resource: ASSET_GALLERY_RESOURCE_URI,
|
|
79
|
+
scopes: [],
|
|
80
|
+
read: async (_client, _uri, _extra) => ({
|
|
81
|
+
contents: [{
|
|
82
|
+
uri: ASSET_GALLERY_RESOURCE_URI,
|
|
83
|
+
mimeType: MCP_APP_MIME_TYPE,
|
|
84
|
+
text: getAssetGalleryHtml(),
|
|
85
|
+
_meta: {
|
|
86
|
+
ui: {
|
|
87
|
+
csp: {
|
|
88
|
+
resourceDomains: [
|
|
89
|
+
"https://res.cloudinary.com",
|
|
90
|
+
"https://*.cloudinary.com",
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
} as any],
|
|
96
|
+
}),
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Asset details MCP App — interactive UI for get-asset-details results
|
|
100
|
+
register.resource({
|
|
101
|
+
name: "Asset Details Widget",
|
|
102
|
+
description: "Interactive single-asset detail view for Cloudinary assets",
|
|
103
|
+
metadata: {
|
|
104
|
+
mimeType: MCP_APP_MIME_TYPE,
|
|
105
|
+
},
|
|
106
|
+
resource: ASSET_DETAILS_RESOURCE_URI,
|
|
107
|
+
scopes: [],
|
|
108
|
+
read: async (_client, _uri, _extra) => ({
|
|
109
|
+
contents: [{
|
|
110
|
+
uri: ASSET_DETAILS_RESOURCE_URI,
|
|
111
|
+
mimeType: MCP_APP_MIME_TYPE,
|
|
112
|
+
text: getAssetDetailsHtml(),
|
|
113
|
+
_meta: {
|
|
114
|
+
ui: {
|
|
115
|
+
csp: {
|
|
116
|
+
resourceDomains: [
|
|
117
|
+
"https://res.cloudinary.com",
|
|
118
|
+
"https://*.cloudinary.com",
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
} as any],
|
|
124
|
+
}),
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// Asset upload MCP App — interactive upload UI for upload-asset tool
|
|
128
|
+
register.resource({
|
|
129
|
+
name: "Asset Upload Widget",
|
|
130
|
+
description: "Interactive upload interface for uploading assets to Cloudinary",
|
|
131
|
+
metadata: {
|
|
132
|
+
mimeType: MCP_APP_MIME_TYPE,
|
|
133
|
+
},
|
|
134
|
+
resource: ASSET_UPLOAD_RESOURCE_URI,
|
|
135
|
+
scopes: [],
|
|
136
|
+
read: async (_client, _uri, _extra) => ({
|
|
137
|
+
contents: [{
|
|
138
|
+
uri: ASSET_UPLOAD_RESOURCE_URI,
|
|
139
|
+
mimeType: MCP_APP_MIME_TYPE,
|
|
140
|
+
text: getAssetUploadHtml(),
|
|
141
|
+
_meta: {
|
|
142
|
+
ui: {
|
|
143
|
+
csp: {
|
|
144
|
+
resourceDomains: [
|
|
145
|
+
"https://res.cloudinary.com",
|
|
146
|
+
"https://*.cloudinary.com",
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
} as any],
|
|
152
|
+
}),
|
|
153
|
+
});
|
|
154
|
+
|
|
58
155
|
// Transform asset tool using explicit API with eager transformations
|
|
59
156
|
register.tool({
|
|
60
157
|
name: "transform-asset",
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import * as z from "zod";
|
|
7
7
|
import { assetsGetResourceByAssetId } from "../../funcs/assetsGetResourceByAssetId.js";
|
|
8
8
|
import { formatResult, ToolDefinition } from "../tools.js";
|
|
9
|
+
import { ASSET_DETAILS_RESOURCE_URI } from "../widgets/asset-details-widget.js";
|
|
9
10
|
|
|
10
11
|
const args = {
|
|
11
12
|
asset_id: z.string().describe(
|
|
@@ -59,6 +60,9 @@ Returns the details of a single resource specified by its asset ID.`,
|
|
|
59
60
|
"openWorldHint": false,
|
|
60
61
|
"readOnlyHint": true,
|
|
61
62
|
},
|
|
63
|
+
_meta: {
|
|
64
|
+
ui: { resourceUri: ASSET_DETAILS_RESOURCE_URI },
|
|
65
|
+
},
|
|
62
66
|
args,
|
|
63
67
|
tool: async (client, args, ctx) => {
|
|
64
68
|
const [result] = await assetsGetResourceByAssetId(
|
|
@@ -8,6 +8,7 @@ import { assetsListImages } from "../../funcs/assetsListImages.js";
|
|
|
8
8
|
import { Direction$zodSchema } from "../../models/direction.js";
|
|
9
9
|
import { FieldsSpec$zodSchema } from "../../models/fieldsspec.js";
|
|
10
10
|
import { ListStorageType$zodSchema } from "../../models/liststoragetype.js";
|
|
11
|
+
import { ASSET_GALLERY_RESOURCE_URI } from "../widgets/asset-gallery-widget.js";
|
|
11
12
|
import { formatResult, ToolDefinition } from "../tools.js";
|
|
12
13
|
|
|
13
14
|
const args = {
|
|
@@ -46,6 +47,9 @@ Retrieves a list of image assets. Results can be filtered by various criteria li
|
|
|
46
47
|
"openWorldHint": false,
|
|
47
48
|
"readOnlyHint": true,
|
|
48
49
|
},
|
|
50
|
+
_meta: {
|
|
51
|
+
ui: { resourceUri: ASSET_GALLERY_RESOURCE_URI },
|
|
52
|
+
},
|
|
49
53
|
args,
|
|
50
54
|
tool: async (client, args, ctx) => {
|
|
51
55
|
const [result] = await assetsListImages(
|
|
@@ -9,6 +9,7 @@ import { Direction$zodSchema } from "../../models/direction.js";
|
|
|
9
9
|
import { FieldsSpec$zodSchema } from "../../models/fieldsspec.js";
|
|
10
10
|
import { ListStorageType$zodSchema } from "../../models/liststoragetype.js";
|
|
11
11
|
import { formatResult, ToolDefinition } from "../tools.js";
|
|
12
|
+
import { ASSET_GALLERY_RESOURCE_URI } from "../widgets/asset-gallery-widget.js";
|
|
12
13
|
|
|
13
14
|
const args = {
|
|
14
15
|
type: ListStorageType$zodSchema.optional().describe(
|
|
@@ -46,6 +47,9 @@ Retrieves a list of raw assets. Results can be filtered by various criteria like
|
|
|
46
47
|
"openWorldHint": false,
|
|
47
48
|
"readOnlyHint": true,
|
|
48
49
|
},
|
|
50
|
+
_meta: {
|
|
51
|
+
ui: { resourceUri: ASSET_GALLERY_RESOURCE_URI },
|
|
52
|
+
},
|
|
49
53
|
args,
|
|
50
54
|
tool: async (client, args, ctx) => {
|
|
51
55
|
const [result] = await assetsListRawFiles(
|
|
@@ -9,6 +9,7 @@ import { Direction$zodSchema } from "../../models/direction.js";
|
|
|
9
9
|
import { FieldsSpec$zodSchema } from "../../models/fieldsspec.js";
|
|
10
10
|
import { ListStorageType$zodSchema } from "../../models/liststoragetype.js";
|
|
11
11
|
import { formatResult, ToolDefinition } from "../tools.js";
|
|
12
|
+
import { ASSET_GALLERY_RESOURCE_URI } from "../widgets/asset-gallery-widget.js";
|
|
12
13
|
|
|
13
14
|
const args = {
|
|
14
15
|
type: ListStorageType$zodSchema.optional().describe(
|
|
@@ -46,6 +47,9 @@ Retrieves a list of video assets. Results can be filtered by various criteria li
|
|
|
46
47
|
"openWorldHint": false,
|
|
47
48
|
"readOnlyHint": true,
|
|
48
49
|
},
|
|
50
|
+
_meta: {
|
|
51
|
+
ui: { resourceUri: ASSET_GALLERY_RESOURCE_URI },
|
|
52
|
+
},
|
|
49
53
|
args,
|
|
50
54
|
tool: async (client, args, ctx) => {
|
|
51
55
|
const [result] = await assetsListVideos(
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { searchSearchAssets } from "../../funcs/searchSearchAssets.js";
|
|
7
7
|
import { SearchParameters$zodSchema } from "../../models/searchparameters.js";
|
|
8
8
|
import { formatResult, ToolDefinition } from "../tools.js";
|
|
9
|
+
import { ASSET_GALLERY_RESOURCE_URI } from "../widgets/asset-gallery-widget.js";
|
|
9
10
|
|
|
10
11
|
const args = {
|
|
11
12
|
request: SearchParameters$zodSchema,
|
|
@@ -30,6 +31,9 @@ Examples: tags:shirt AND uploaded_at>1d, resource_type:image AND bytes>1mb, fold
|
|
|
30
31
|
"openWorldHint": false,
|
|
31
32
|
"readOnlyHint": true,
|
|
32
33
|
},
|
|
34
|
+
_meta: {
|
|
35
|
+
ui: { resourceUri: ASSET_GALLERY_RESOURCE_URI },
|
|
36
|
+
},
|
|
33
37
|
args,
|
|
34
38
|
tool: async (client, args, ctx) => {
|
|
35
39
|
const [result] = await searchSearchAssets(
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { uploadUpload } from "../../funcs/uploadUpload.js";
|
|
7
7
|
import { UploadRequest$zodSchema } from "../../models/uploadrequest.js";
|
|
8
8
|
import { UploadResourceType$zodSchema } from "../../models/uploadresourcetype.js";
|
|
9
|
+
import { ASSET_UPLOAD_RESOURCE_URI } from "../widgets/asset-upload-widget.js";
|
|
9
10
|
import { formatResult, ToolDefinition } from "../tools.js";
|
|
10
11
|
|
|
11
12
|
const args = {
|
|
@@ -48,6 +49,9 @@ Transform media files using transformation syntax in delivery URLs, which create
|
|
|
48
49
|
"openWorldHint": false,
|
|
49
50
|
"readOnlyHint": false,
|
|
50
51
|
},
|
|
52
|
+
_meta: {
|
|
53
|
+
ui: { resourceUri: ASSET_UPLOAD_RESOURCE_URI },
|
|
54
|
+
},
|
|
51
55
|
args,
|
|
52
56
|
tool: async (client, args, ctx) => {
|
|
53
57
|
const [result] = await uploadUpload(
|
package/src/mcp-server/tools.ts
CHANGED
|
@@ -80,6 +80,7 @@ export type ToolDefinition<
|
|
|
80
80
|
openWorldHint: boolean;
|
|
81
81
|
readOnlyHint: boolean;
|
|
82
82
|
};
|
|
83
|
+
_meta?: Record<string, unknown>;
|
|
83
84
|
tool: (
|
|
84
85
|
client: CloudinaryAssetMgmtCore,
|
|
85
86
|
args: ShapeOutput<Args>,
|
|
@@ -98,6 +99,7 @@ export type ToolDefinition<
|
|
|
98
99
|
openWorldHint: boolean;
|
|
99
100
|
readOnlyHint: boolean;
|
|
100
101
|
};
|
|
102
|
+
_meta?: Record<string, unknown>;
|
|
101
103
|
tool: (
|
|
102
104
|
client: CloudinaryAssetMgmtCore,
|
|
103
105
|
extra: RequestHandlerExtra<ServerRequest, ServerNotification>,
|
|
@@ -212,6 +214,7 @@ export function createRegisterTool(
|
|
|
212
214
|
description: tool.description,
|
|
213
215
|
inputSchema: tool.args,
|
|
214
216
|
annotations: tool.annotations,
|
|
217
|
+
...(tool._meta ? { _meta: tool._meta } : {}),
|
|
215
218
|
},
|
|
216
219
|
async (args, ctx) => {
|
|
217
220
|
return tool.tool(getSDK(), args, ctx);
|
|
@@ -223,6 +226,7 @@ export function createRegisterTool(
|
|
|
223
226
|
{
|
|
224
227
|
description: tool.description,
|
|
225
228
|
annotations: tool.annotations,
|
|
229
|
+
...(tool._meta ? { _meta: tool._meta } : {}),
|
|
226
230
|
},
|
|
227
231
|
async (ctx) => {
|
|
228
232
|
return tool.tool(getSDK(), ctx);
|