@centrali-io/centrali-mcp 4.5.1 → 4.5.2
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/tools/describe.js +32 -0
- package/package.json +1 -1
- package/src/tools/describe.ts +32 -0
package/dist/tools/describe.js
CHANGED
|
@@ -368,6 +368,37 @@ function registerDescribeTools(server) {
|
|
|
368
368
|
"}",
|
|
369
369
|
].join("\n"),
|
|
370
370
|
},
|
|
371
|
+
media_metadata: {
|
|
372
|
+
description: "When audio or video files are uploaded, Centrali automatically extracts metadata (duration, codec, resolution, bitrate) using FFprobe and stores it on the file record.",
|
|
373
|
+
api_response: "GET /files/meta/{id} returns duration (seconds), width, height, codec, and bitrate fields for media files. These fields are null for non-media files.",
|
|
374
|
+
render_url_headers: {
|
|
375
|
+
description: "The render URL response includes media metadata as HTTP headers — no separate API call needed.",
|
|
376
|
+
headers: {
|
|
377
|
+
"X-Media-Duration": "Duration in seconds (e.g., '42.350')",
|
|
378
|
+
"X-Media-Width": "Video width in pixels",
|
|
379
|
+
"X-Media-Height": "Video height in pixels",
|
|
380
|
+
"X-Media-Codec": "Primary codec (e.g., 'opus', 'aac', 'h264')",
|
|
381
|
+
"X-Media-Bitrate": "Bitrate in bits per second",
|
|
382
|
+
},
|
|
383
|
+
note: "Headers are only present when metadata is available. Use a HEAD request to retrieve metadata without downloading the file. All X-Media-* headers are exposed via CORS.",
|
|
384
|
+
},
|
|
385
|
+
example: [
|
|
386
|
+
"// Get duration from render URL headers (no extra API call)",
|
|
387
|
+
"const url = centrali.getFileRenderUrl(renderId);",
|
|
388
|
+
"const resp = await fetch(url, {",
|
|
389
|
+
" method: 'HEAD',",
|
|
390
|
+
" headers: { Authorization: `Bearer ${token}` }",
|
|
391
|
+
"});",
|
|
392
|
+
"const duration = parseFloat(resp.headers.get('X-Media-Duration') ?? '0');",
|
|
393
|
+
"const codec = resp.headers.get('X-Media-Codec');",
|
|
394
|
+
"",
|
|
395
|
+
"// Or get it from the file metadata API",
|
|
396
|
+
"const fileMeta = await centrali.getFileMeta(fileId);",
|
|
397
|
+
"console.log(fileMeta.duration); // 42.35 (seconds)",
|
|
398
|
+
"console.log(fileMeta.codec); // 'opus'",
|
|
399
|
+
].join("\n"),
|
|
400
|
+
supported_formats: "All formats FFprobe can parse — MP3, AAC, WAV, FLAC, OGG, WebM/Opus, MP4, WebM/VP9, MOV, AVI, and more.",
|
|
401
|
+
},
|
|
371
402
|
download_url: {
|
|
372
403
|
method: "client.getFileDownloadUrl(renderId)",
|
|
373
404
|
note: "Returns a URL that triggers a file download. Same auth rules as render URLs.",
|
|
@@ -378,6 +409,7 @@ function registerDescribeTools(server) {
|
|
|
378
409
|
"Store the renderId on a record field — then use getFileRenderUrl() to build the URL when displaying",
|
|
379
410
|
"Use image transformations for thumbnails instead of uploading multiple sizes",
|
|
380
411
|
"For private images in browser apps: either use a server-side proxy route or a publishable key with storage scope",
|
|
412
|
+
"For audio/video files: use X-Media-Duration header or file metadata API to get duration — don't rely on browser metadata parsing, which fails for some container formats (e.g., WebM/Opus)",
|
|
381
413
|
],
|
|
382
414
|
},
|
|
383
415
|
realtime: {
|
package/package.json
CHANGED
package/src/tools/describe.ts
CHANGED
|
@@ -376,6 +376,37 @@ export function registerDescribeTools(server: McpServer) {
|
|
|
376
376
|
"}",
|
|
377
377
|
].join("\n"),
|
|
378
378
|
},
|
|
379
|
+
media_metadata: {
|
|
380
|
+
description: "When audio or video files are uploaded, Centrali automatically extracts metadata (duration, codec, resolution, bitrate) using FFprobe and stores it on the file record.",
|
|
381
|
+
api_response: "GET /files/meta/{id} returns duration (seconds), width, height, codec, and bitrate fields for media files. These fields are null for non-media files.",
|
|
382
|
+
render_url_headers: {
|
|
383
|
+
description: "The render URL response includes media metadata as HTTP headers — no separate API call needed.",
|
|
384
|
+
headers: {
|
|
385
|
+
"X-Media-Duration": "Duration in seconds (e.g., '42.350')",
|
|
386
|
+
"X-Media-Width": "Video width in pixels",
|
|
387
|
+
"X-Media-Height": "Video height in pixels",
|
|
388
|
+
"X-Media-Codec": "Primary codec (e.g., 'opus', 'aac', 'h264')",
|
|
389
|
+
"X-Media-Bitrate": "Bitrate in bits per second",
|
|
390
|
+
},
|
|
391
|
+
note: "Headers are only present when metadata is available. Use a HEAD request to retrieve metadata without downloading the file. All X-Media-* headers are exposed via CORS.",
|
|
392
|
+
},
|
|
393
|
+
example: [
|
|
394
|
+
"// Get duration from render URL headers (no extra API call)",
|
|
395
|
+
"const url = centrali.getFileRenderUrl(renderId);",
|
|
396
|
+
"const resp = await fetch(url, {",
|
|
397
|
+
" method: 'HEAD',",
|
|
398
|
+
" headers: { Authorization: `Bearer ${token}` }",
|
|
399
|
+
"});",
|
|
400
|
+
"const duration = parseFloat(resp.headers.get('X-Media-Duration') ?? '0');",
|
|
401
|
+
"const codec = resp.headers.get('X-Media-Codec');",
|
|
402
|
+
"",
|
|
403
|
+
"// Or get it from the file metadata API",
|
|
404
|
+
"const fileMeta = await centrali.getFileMeta(fileId);",
|
|
405
|
+
"console.log(fileMeta.duration); // 42.35 (seconds)",
|
|
406
|
+
"console.log(fileMeta.codec); // 'opus'",
|
|
407
|
+
].join("\n"),
|
|
408
|
+
supported_formats: "All formats FFprobe can parse — MP3, AAC, WAV, FLAC, OGG, WebM/Opus, MP4, WebM/VP9, MOV, AVI, and more.",
|
|
409
|
+
},
|
|
379
410
|
download_url: {
|
|
380
411
|
method: "client.getFileDownloadUrl(renderId)",
|
|
381
412
|
note: "Returns a URL that triggers a file download. Same auth rules as render URLs.",
|
|
@@ -386,6 +417,7 @@ export function registerDescribeTools(server: McpServer) {
|
|
|
386
417
|
"Store the renderId on a record field — then use getFileRenderUrl() to build the URL when displaying",
|
|
387
418
|
"Use image transformations for thumbnails instead of uploading multiple sizes",
|
|
388
419
|
"For private images in browser apps: either use a server-side proxy route or a publishable key with storage scope",
|
|
420
|
+
"For audio/video files: use X-Media-Duration header or file metadata API to get duration — don't rely on browser metadata parsing, which fails for some container formats (e.g., WebM/Opus)",
|
|
389
421
|
],
|
|
390
422
|
},
|
|
391
423
|
realtime: {
|