The analyze_capabilities tool provides comprehensive analysis of package capabilities, including module systems, TypeScript support, platform compatibility, and more.
- ESM (ES Modules):
import/exportsyntax - CommonJS:
require/module.exports - UMD: Universal Module Definition
- Dual Package: Supports both ESM and CommonJS
Example output:
{
"esm": true,
"commonjs": true,
"dualPackage": true,
"details": [
"Package type: 'module' (native ESM)",
"Dual package: ESM + CommonJS support"
]
}- Built-in type definitions
- Separate
@types/package needed - Written in TypeScript
- Location of
.d.tsfiles
Example output:
{
"hasTypes": true,
"typesLocation": "./dist/index.d.ts",
"isTypeScriptPackage": true,
"details": [
"Type definitions: ./dist/index.d.ts",
"Built with TypeScript"
]
}- Node.js: Server-side JavaScript
- Browser: Client-side JavaScript
- Deno: Modern TypeScript runtime
- Bun: Fast all-in-one JavaScript runtime
- React: React component/library
- React Native: Mobile development
Example output:
{
"node": true,
"browser": true,
"deno": false,
"details": [
"Node.js: >=18.0.0",
"Browser support in exports"
]
}- Conditional exports (
import/require/types) - Subpath exports (
./utils,./components) - Modern package structure
Example output:
{
"hasExports": true,
"conditionalExports": true,
"subpathExports": true,
"details": [
"Conditional exports (import/require/types)",
"Subpaths: ./client, ./server, ./utils"
]
}Detects build tools used:
- Webpack, Rollup, Vite, esbuild
- TypeScript compiler
- Babel, SWC
- tsup
- Node.js version required
- npm/yarn/pnpm versions
- Other runtime requirements
// Tool call
analyze_capabilities({
packageName: "vite"
})
// Response
{
"success": true,
"package": {
"name": "vite",
"version": "5.0.0"
},
"moduleSystem": {
"esm": true,
"commonjs": true,
"dualPackage": true
},
"typescript": {
"hasTypes": true,
"typesLocation": "./dist/node/index.d.ts"
},
"platform": {
"node": true,
"browser": false
},
"summary": "✅ Dual Package: ESM + CommonJS\n✅ TypeScript definitions included\n✅ Platforms: Node.js\n✅ Modern package (uses exports field)"
}analyze_capabilities({
packageName: "express",
version: "4.18.2"
})Before adding a package to an ESM + TypeScript project:
User: "I need an HTTP client for my TypeScript ESM project"
AI automatically:
1. search_packages("http client node")
2. For top results:
- analyze_capabilities("axios")
- analyze_capabilities("node-fetch")
- analyze_capabilities("undici")
3. Filters by:
- ESM support ✅
- TypeScript types ✅
4. Recommends: undici (native ESM + TS)
When migrating from CommonJS to ESM:
analyze_capabilities("lodash")
Result:
{
"moduleSystem": {
"esm": false,
"commonjs": true
}
}
AI suggests: "lodash-es" (ESM version) or tree-shakeable alternative
Building for both Node.js and Browser:
analyze_capabilities("date-fns")
Result:
{
"platform": {
"node": true,
"browser": true
}
}
✅ Works in both environments
When Cursor Agent generates code:
User: "Build a TypeScript ESM API"
Cursor Agent:
1. About to add express
2. analyze_capabilities("express")
3. Finds: CommonJS-only, no native ESM
4. Switches to: fastify (ESM + TS)
5. Generates modern code with ESM imports
// After finding packages
search_packages("state management")
.then(results => {
// Check capabilities for each
results.forEach(pkg =>
analyze_capabilities(pkg.name)
);
});// Comprehensive check
1. audit_security("package") // Security
2. check_compatibility("package") // Compatibility
3. analyze_capabilities("package") // Capabilities
4. Decision: ✅ Safe + Modern or ⚠️ Issues// Audit all dependencies
{
"dependencies": {
"express": "4.18.2", // Check capabilities
"axios": "1.6.0", // Check capabilities
"lodash": "4.17.21" // Check capabilities
}
}
// Report:
- express: ⚠️ CommonJS-only (consider fastify)
- axios: ✅ Dual package + Types
- lodash: ⚠️ Large + No ESM (use lodash-es){
"moduleSystem": {
"esm": true,
"commonjs": true,
"dualPackage": true,
"details": [
"Package type: 'module' (native ESM)",
"Dual package: ESM + CommonJS support"
]
},
"typescript": {
"hasTypes": true,
"typesLocation": "./dist/node/index.d.ts",
"isTypeScriptPackage": true
},
"exports": {
"hasExports": true,
"conditionalExports": true
},
"summary": "✅ Dual Package: ESM + CommonJS\n✅ TypeScript definitions included\n✅ Modern package"
}{
"moduleSystem": {
"esm": false,
"commonjs": true,
"dualPackage": false,
"details": [
"Main file: index.js (likely CommonJS)"
]
},
"typescript": {
"hasTypes": false,
"details": [
"May need @types/express for TypeScript support"
]
},
"summary": "✅ CommonJS\n⚠️ No TypeScript definitions (may need @types package)"
}{
"platform": {
"node": true,
"browser": true
},
"moduleSystem": {
"dualPackage": true
},
"summary": "✅ Dual Package: ESM + CommonJS\n✅ Platforms: Node.js, Browser"
}Look for:
- ✅
dualPackage: trueoresm: true - ✅
hasTypes: true - ✅
exports.hasExports: true - ✅ Recent
engines.nodeversion
Watch out for:
⚠️ No ESM support (CommonJS-only)⚠️ No TypeScript types⚠️ Old Node.js engine requirement⚠️ No exports field (legacy structure)
If package lacks modern features:
- CommonJS-only → Find ESM alternative
- No types → Check for
@types/package - Old package → Look for actively maintained fork
This tool helps ensure your project uses modern, well-maintained packages with the right capabilities for your stack! 🎯