mcp-talent-server
Version:
Model Context Protocol server for talent management tools
80 lines • 9.19 kB
TypeScript
import { z } from 'zod';
import type { FolderType, ImageType } from '../types/index.js';
declare const GalleryZipExportInput: z.ZodObject<{
folderNames: z.ZodArray<z.ZodString, "many">;
imageNames: z.ZodArray<z.ZodString, "many">;
foldersSearchQuery: z.ZodString;
imagesSearchQuery: z.ZodString;
includeSubfolders: z.ZodDefault<z.ZodBoolean>;
maxImages: z.ZodDefault<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
folderNames: string[];
imageNames: string[];
foldersSearchQuery: string;
imagesSearchQuery: string;
includeSubfolders: boolean;
maxImages: number;
}, {
folderNames: string[];
imageNames: string[];
foldersSearchQuery: string;
imagesSearchQuery: string;
includeSubfolders?: boolean | undefined;
maxImages?: number | undefined;
}>;
interface SearchResult {
image: ImageType;
folder: FolderType;
folderPath: string;
matchScore?: number;
matchType?: 'image_name' | 'folder_name';
}
export declare class GalleryZipExporter {
private buildFolderPath;
private downloadImage;
private createZipFile;
private uploadZipToS3;
exportGallerySearch(input: z.infer<typeof GalleryZipExportInput>): Promise<{
downloadUrl: string;
filename: string;
stats: {
totalImages: number;
zipSizeBytes: number;
searchQuery: string;
exportDate: string;
folders: string[];
};
}>;
private validateExportInput;
private createZipFileWithValidation;
private generateSafeFilename;
private uploadZipToS3WithRetry;
private extractUniqueFolders;
private logExportError;
exportImagesAndFolders(folderNames: string[], imageNames: string[], maxImages: number, includeSubfolders: boolean, foldersSearchQuery: string, imagesSearchQuery: string): Promise<SearchResult[]>;
}
export declare const GalleryZipExportDescription = "**Gallery Zip Export \u2013 Intelligent Media Asset Packaging Tool**\n\nYou are tasked with designing and/or describing the complete logic and output for an automated, intelligent tool that enables exporting and packaging talent gallery images into downloadable ZIP files. This tool must utilize advanced search and scoring algorithms, database and naming logic, robust cloud storage integration, and detailed metadata/export reporting.\n\nThe output must always present a single downloadable ZIP file link, accompanied by comprehensive metadata and statistics. At every stage, first explain your reasoning for each decision or output before providing the results.\n\nBelow, follow the steps and requirements in order. Examples are provided to illustrate expected reasoning, workflows, inputs, and outputs.\n\n\n# Steps\n\n1. **Input Interpretation & Parameter Extraction**\n - Identify the user's request scope (e.g., specific platform content, creator folders, date ranges, etc.) from the command or use case.\n - Parse/validate all parameters: folderNames, imageNames, foldersSearchQuery, imagesSearchQuery, maxImages, includeSubfolders.\n\n2. **Smart Search & Scoring**\n - For each supplied folderName and image criteria, build and explain search queries against the database (MongoDB) that reflect supplied filters, recursion, and any custom requirements.\n - For every folder and image found, apply the advanced scoring algorithm:\n - Exact (10/10), Prefix (9/10), Contains (7/10), Fuzzy (6/10), multi-term bonus, and include only items with score \u22658/10.\n - Describe WHY each folder/image is selected, detailing the matching rules and score breakdown.\n\n3. **Validation & Error Handling**\n - For all scored images, confirm existence and accessibility.\n - Document reasoning and action for any missing or problematic files (e.g., skipped, retried).\n\n4. **Packaging**\n - Retrieve all qualifying images, structure them in a ZIP file mirroring the original folder/naming hierarchy.\n - Reason through folder structure preservation, recursive subfolders, and metadata inclusion.\n\n5. **Upload & Delivery**\n - Automatically upload the ZIP file to AWS S3 (with security, named uniquely).\n - Generate a time-limited, secure public download link.\n - Ensure robust retry logic and performance practices (including concurrent processing, real-time tracking).\n\n6. **Export Reporting & Statistics**\n - Prepare a metadata report detailing:\n - Number of images included, folders involved, export time, ZIP file size, creation timestamp, expiration time.\n - Detailed scoring breakdown (for folders/images selected), inclusion criteria, and errors encountered.\n - Quality control, access control, how cloud/storage/cleanup was performed.\n\n7. **Return Output**\n - First summarize your reasoning and all selection/validation processes.\n - Then, provide the final structured response as specified below.\n\n# Output Format\n\nAll final outputs must be provided in a valid, unwrapped JSON object (not inside code blocks), with these keys:\n\n- download_url: [public ZIP link]\n- file_metadata: {size_bytes, created_at, expires_at}\n- export_statistics: {image_count, folder_count, processing_time_sec}\n- match_details: [list of {folder/image, search_terms, score, match_type, included: true/false, notes}]\n- error_reports: [any missing files, failures, and explanation of recovery or omission]\n\nPrecede the JSON with your step-by-step reasoning for search, scoring, and error handling (as prose, 1-2 paragraphs).\n\n# Examples\n\n**Example 1 \u2013 Request**\n- Input: \"Export all Instagram content for Yosef Haiem\"\n- Parameters: folderNames=[\"Yosef Haiem\"], imageNames=[\"IG*\"], includeSubfolders=true, maxImages=50\n\n**Example 1 \u2013 Reasoning**\nThe request targets all Instagram media in the \"Yosef Haiem\" folder, including subfolders. I searched for folders named \"Yosef Haiem\" using a prefix and exact match, then queried all images with the IG platform prefix. Each image was scored using the algorithm (exact prefix for \"IG\" = 9/10), and only those scoring \u22658/10 were included. Any missing files were logged and excluded from packaging. The ZIP preserved all folder structure and was securely uploaded to S3.\n\n**Example 1 \u2013 Output**\n{\n \"download_url\": \"https://s3.amazonaws.com/bucket/hash_export_yosef_IG.zip\",\n \"file_metadata\": {\n \"size_bytes\": 83456789,\n \"created_at\": \"2024-07-10T13:56:04Z\",\n \"expires_at\": \"2024-07-17T13:56:04Z\"\n },\n \"export_statistics\": {\n \"image_count\": 37,\n \"folder_count\": 1,\n \"processing_time_sec\": 48.2\n },\n \"match_details\": [\n {\"file\": \"IG Story 001.jpg\", \"search_terms\": [\"IG*\"], \"score\": 9.0, \"match_type\": \"Prefix\", \"included\": true, \"notes\": \"\"},\n {\"file\": \"IG Live 008.jpg\", \"search_terms\": [\"IG*\"], \"score\": 8.5, \"match_type\": \"Prefix\", \"included\": true, \"notes\": \"\"},\n {\"file\": \"YT Age 01.jpg\", \"search_terms\": [\"IG*\"], \"score\": 6.0, \"match_type\": \"Fuzzy\", \"included\": false, \"notes\": \"Score below threshold\"}\n ],\n \"error_reports\": [\n {\"file\": \"IG Reel 003.jpg\", \"issue\": \"File missing from storage\", \"recovery\": \"Omitted from ZIP\"}\n ]\n}\n\n(**Real examples should be scaled up for complex, multi-folder or multi-platform requests, following this same structure.**)\n\n# Notes\n- image name is save as originalName and folder name is save as name\n- folder names in query can be partial so use regex to fetch folders in mongodb query\n- always use regex based search searching amoung image names\n- Always perform and explain reasoning and query logic before presenting the final output.\n- Never skip error reporting (missing, skipped, failed files) even if the list is empty.\n- Always preserve security, quality control, and workflow integrity as described.\n- Output must be JSON as detailed above, preceded by prose reasoning/steps. Never wrap JSON in code blocks.\n- In output always mention which folder and image are found which are not available in database.\n\n**Reminder**: Begin each output with a paragraph or two summarizing reasoning, search/matching/scoring steps, and error recovery, then return the requested fields in a single JSON object. Always output exactly one downloadable ZIP link and include all mandatory metadata/statistics.";
export declare const galleryZipExportSchema: z.ZodObject<{
folderNames: z.ZodArray<z.ZodString, "many">;
imageNames: z.ZodArray<z.ZodString, "many">;
foldersSearchQuery: z.ZodString;
imagesSearchQuery: z.ZodString;
includeSubfolders: z.ZodDefault<z.ZodBoolean>;
maxImages: z.ZodDefault<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
folderNames: string[];
imageNames: string[];
foldersSearchQuery: string;
imagesSearchQuery: string;
includeSubfolders: boolean;
maxImages: number;
}, {
folderNames: string[];
imageNames: string[];
foldersSearchQuery: string;
imagesSearchQuery: string;
includeSubfolders?: boolean | undefined;
maxImages?: number | undefined;
}>;
export {};
//# sourceMappingURL=gallery-zip-export.d.ts.map