Skip to content

feat: add new skills for writing typescript code for imagekit_api mcp server#2

Open
shivamik wants to merge 5 commits into
mainfrom
imagekit-api-mcp-service
Open

feat: add new skills for writing typescript code for imagekit_api mcp server#2
shivamik wants to merge 5 commits into
mainfrom
imagekit-api-mcp-service

Conversation

@shivamik

Copy link
Copy Markdown
Collaborator
  • Bump up the version
  • Add new skill for writing typescript code for imagekit_api mcp server

shivamik added 2 commits June 18, 2026 18:40
… 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
Comment thread skills/mcp-preflight/SKILL.md Outdated
@imagekitio

imagekitio commented Jun 21, 2026

Copy link
Copy Markdown

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.

shivamik added 3 commits June 24, 2026 19:28
…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

@manu4543 manu4543 Jun 25, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker, just curious, why would mcp ever need webhook related stuff?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then why add it.

|------|----------|
| `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 |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

The code tool is supposed to write typescript code only. We need to change the tool for that.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The errors that are without any skills are mostly type errors.

}

// Error handling
import ImageKit from '@imagekit/nodejs';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This contradicts our tool prompt

Image

Comment thread skills/imagekit-sdk-reference/SKILL.md
// 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`.

@manu4543 manu4543 Jun 26, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Image

unrelated, but it also fixes - imagekit-developer/imagekit-nodejs#114

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be done for other union types too, are there any other union types?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants