imagekit-sdk-reference
Installation
SKILL.md
ImageKit TypeScript SDK Reference
Read this skill before calling any mcp_imagekit_api_* tool or writing TypeScript code against the ImageKit SDK. It contains exact method signatures, parameter types, return shapes, and error handling patterns for @imagekit/nodejs.
Rules:
- Use exact parameter names — the SDK is strict about camelCase
assets.list()returns(File | Folder)[]. Narrow withfor...of+if (item.type === 'file'), never.filter((i): i is File => ...). See thesearch-assetsskill for the full rules onsearchQueryvs a typedFile[]and why the predicate fails.- In
execute/MCP code, do NOT try/catch single API calls — the tool reports errors for you. Only catch when you branch on a specific failure, and duck-type the error ('status' in err) rather thaninstanceof ImageKit.APIError, since a value import of the SDK is not available in the sandbox. - Use
skip/limitfor pagination (max 1000 per request) - Uploads are URL-only — the
fileparam must be a URL string; local file paths, Buffers, and streams cannot be passed. Read theupload-filesskill first. - Nullable properties (
tags,AITags,customCoordinates) require optional chaining (?.) or null checks .find()returnsT | undefined— always check forundefinedbefore accessing properties
TypeScript Gotchas
Union narrowing for assets.list() results — for...of + if, why the .filter((i): i is File => ...) predicate collides with Deno's global File, and searchQuery vs a typed File[] — is covered in full by the search-assets skill; follow it when handling list results. The gotchas below are the SDK-specific ones not covered there.