feat: add new skills for writing typescript code for imagekit_api mcp server#2
feat: add new skills for writing typescript code for imagekit_api mcp server#2shivamik wants to merge 5 commits into
Conversation
shivamik
commented
Jun 18, 2026
- Bump up the version
- Add new skill for writing typescript code for imagekit_api mcp server
… and imagekit-plugin chore(mcp): fix API URL in mcp configuration docs(README): add imagekit-sdk-reference skill to documentation chore(skills): include imagekit-sdk-reference in skills list
|
We need to add skill that covers advance search query syntax. Search is common use-case and without skill, it would not be able to do it right in first few attempts. Ultimately it uses dev tool search_docs and does find correct syntax but a skill could have prevented it. This skill should pick examples from docs, especially around custom metadata and their CRUD too. On similar lines, we also need a skill for integration. We have SDK for all languages but maybe a simple skill to just cover what we have so that if anyone is integrating imagekit, agent knows what all is possible and how to build further using search_doc. |
…e type gotchas - Add search-assets skill: searchQuery filter syntax, operators, and field reference for client.assets.list() - Add imagekit-integrations skill: index of ImageKit SDKs, plugins, and integrations - Register both new skills under the General grouping in skills.sh.json - imagekit-sdk-reference: add TypeScript Gotchas section explaining why .filter() with `item is File` fails in MCP/Deno (global File shadows SDK File); recommend for...of + if narrowing; document nullable props, .find() undefined, and webhook discrimination - mcp-preflight: clarify execute tool description and upload routing wording
| file.AITags?.map(...); // ✅ | ||
| ``` | ||
|
|
||
| ### Webhook event discrimination |
There was a problem hiding this comment.
Not a blocker, just curious, why would mcp ever need webhook related stuff?
There was a problem hiding this comment.
I cant think of usecase either. The only thing that user will do according to me is to write a server for which devtool_mcp_search_doc will be enough!
| |------|----------| | ||
| | `search_doc` | Local search that only searches TypeScript SDK code — use to find method signatures and types | | ||
| | `execute` | LLM writes TypeScript code and the server executes it. **All operations go through this tool.** | | ||
| | `execute` | Executes TypeScript code against the ImageKit SDK to perform CRUD operations | |
There was a problem hiding this comment.
In most of the gotach, it is due to incorrect types, right? Can't LLM just provide javascript code and can't this execute run that. What is the benefit of TS code here?
There was a problem hiding this comment.
but would it be better or worse? are the errors that it runs into are just pure type error. Or are they helping LLM write better code?
There was a problem hiding this comment.
The errors that are without any skills are mostly type errors.
| } | ||
|
|
||
| // Error handling | ||
| import ImageKit from '@imagekit/nodejs'; |
There was a problem hiding this comment.
Value import of the SDK crashes at runtime: TypeError: Import "@imagekit/nodejs" not a dependency. Only import type survives. So this snippet is incorrect.
| **Rules:** | ||
| 1. Use exact parameter names — the SDK is strict about camelCase | ||
| 2. `assets.list()` returns `(File | Folder)[]` — use `for...of` + `if (item.type === 'file')` to narrow (preferred in MCP/Deno context). Do NOT use `.filter()` — the type predicate `item is File` collides with Deno's global `File` type (see Gotchas). | ||
| 3. Always wrap calls in try/catch for `ImageKit.APIError` |
| // Returns: (File | Folder)[] — a flat array, NOT { files, folders } | ||
| ``` | ||
|
|
||
| **⚠️ CRITICAL: Type narrowing is required.** Even with `type: 'file'`, the TypeScript return type is `(File | Folder)[]`. You MUST narrow before accessing file-only properties like `filePath`, `fileType`, `size`, `url`. |
There was a problem hiding this comment.
For this, how about we make this change in SDK. This way with type: 'file', the return response will always be File[]. Same for folder. These are just signature overrides in typescript. If this is the only error mcp server runs into, then we can get rid of all these gotachs.
unrelated, but it also fixes - imagekit-developer/imagekit-nodejs#114
There was a problem hiding this comment.
this should be done for other union types too, are there any other union types?
There was a problem hiding this comment.
This is the most common operation that will be used and people run into. Others are for origin API, will be rarely used in it.

