Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 06:00 UTC
| 1 | --- |
| 2 | title: 'Limit Parameter Now Prevents Important Flag Auto-Apply' |
| 3 | description: 'When fetching tools with a limit parameter, the important flag is no longer automatically applied, ensuring users get the exact number of tools requested' |
| 4 | date: '2026-02-04' |
| 5 | --- |
| 6 | |
| 7 | ## Version Information |
| 8 | |
| 9 | ### TypeScript/JavaScript |
| 10 | |
| 11 | - Package: `@composio/core` and all provider packages |
| 12 | - Version: `0.6.3`+ |
| 13 | - PR: [#2570](https://github.com/ComposioHQ/composio/pull/2570) |
| 14 | |
| 15 | The `important` flag auto-apply logic has been updated to respect the `limit` parameter. When you provide a `limit`, the SDK no longer automatically applies `important: true`, ensuring you get the exact number of tools you requested. |
| 16 | |
| 17 | ## What Changed |
| 18 | |
| 19 | Previously, when querying tools by toolkit with both `toolkits` and `limit` parameters, the SDK would auto-apply `important: true`. This could result in returning fewer tools than the requested limit if the toolkit had limited important tools. |
| 20 | |
| 21 | **Before:** |
| 22 | |
| 23 | ```typescript |
| 24 | // @noErrors |
| 25 | // Could return < 50 tools if only 10 important tools exist |
| 26 | const tools = await composio.tools.get('default', { |
| 27 | toolkits: ['github'], |
| 28 | limit: 50, |
| 29 | }); |
| 30 | // Result: Only 10 tools (important ones only) |
| 31 | ``` |
| 32 | |
| 33 | **After:** |
| 34 | |
| 35 | ```typescript |
| 36 | // @noErrors |
| 37 | // Returns exactly 50 tools (or all available if < 50) |
| 38 | const tools = await composio.tools.get('default', { |
| 39 | toolkits: ['github'], |
| 40 | limit: 50, |
| 41 | }); |
| 42 | // Result: 50 tools (including non-important) |
| 43 | ``` |
| 44 | |
| 45 | ## Auto-Apply Logic |
| 46 | |
| 47 | The `important` flag is now auto-applied **only when ALL** of these conditions are met: |
| 48 | |
| 49 | - `toolkits` is provided |
| 50 | - `tools` is NOT provided |
| 51 | - `tags` is NOT provided |
| 52 | - `search` is NOT provided |
| 53 | - **`limit` is NOT provided** ← NEW |
| 54 | - `important` is NOT explicitly set to `false` |
| 55 | |
| 56 | ## Examples |
| 57 | |
| 58 | ### Auto-Applies Important (No Limit) |
| 59 | |
| 60 | ```typescript |
| 61 | // @noErrors |
| 62 | const tools = await composio.tools.get('default', { |
| 63 | toolkits: ['github'], |
| 64 | }); |
| 65 | // Returns: ~10-20 important tools |
| 66 | ``` |
| 67 | |
| 68 | ### Does NOT Auto-Apply (Limit Provided) |
| 69 | |
| 70 | ```typescript |
| 71 | // @noErrors |
| 72 | const tools = await composio.tools.get('default', { |
| 73 | toolkits: ['github'], |
| 74 | limit: 50, |
| 75 | }); |
| 76 | // Returns: Exactly 50 tools (or all available) |
| 77 | ``` |
| 78 | |
| 79 | ### Explicit Important Overrides |
| 80 | |
| 81 | ```typescript |
| 82 | // @noErrors |
| 83 | const tools = await composio.tools.get('default', { |
| 84 | toolkits: ['github'], |
| 85 | limit: 50, |
| 86 | important: true, |
| 87 | }); |
| 88 | // Returns: Up to 50 important tools |
| 89 | ``` |
| 90 | |
| 91 | ### Prevents Auto-Apply (Tags Provided) |
| 92 | |
| 93 | ```typescript |
| 94 | // @noErrors |
| 95 | const tools = await composio.tools.get('default', { |
| 96 | toolkits: ['github'], |
| 97 | tags: ['important'], |
| 98 | }); |
| 99 | // Returns: GitHub tools with 'important' tag (no auto-apply) |
| 100 | ``` |
| 101 | |
| 102 | ### Prevents Auto-Apply (Search Provided) |
| 103 | |
| 104 | ```typescript |
| 105 | // @noErrors |
| 106 | const tools = await composio.tools.get('default', { |
| 107 | toolkits: ['github'], |
| 108 | search: 'repository', |
| 109 | }); |
| 110 | // Returns: GitHub tools matching search (no auto-apply) |
| 111 | ``` |
| 112 | |
| 113 | ## Why This Matters |
| 114 | |
| 115 | When you provide a `limit`, you're explicitly requesting a specific number of tools. Auto-applying the `important` filter could prevent you from getting the requested number of tools. This change respects user intent and makes the SDK behavior more predictable. |
| 116 | |
| 117 | **Use cases:** |
| 118 | |
| 119 | 1. **Pagination**: Get exactly N tools per page |
| 120 | 2. **Performance**: Limit tool count for faster responses |
| 121 | 3. **UI constraints**: Display a specific number of tools in your interface |
| 122 | |
| 123 | ## Backward Compatibility |
| 124 | |
| 125 | This change is **backward compatible** with one caveat: |
| 126 | |
| 127 | - **No code changes needed** for most users |
| 128 | - If you were relying on automatic `important` filtering with `limit`, you now need to explicitly pass `important: true` |
| 129 | |
| 130 | **Migration (if needed):** |
| 131 | |
| 132 | ```typescript |
| 133 | // @noErrors |
| 134 | // Before (relied on auto-apply even with limit) |
| 135 | const tools = await composio.tools.get('default', { |
| 136 | toolkits: ['github'], |
| 137 | limit: 20, |
| 138 | }); |
| 139 | |
| 140 | // After (explicit important flag) |
| 141 | const tools = await composio.tools.get('default', { |
| 142 | toolkits: ['github'], |
| 143 | limit: 20, |
| 144 | important: true, // Explicitly set if you want important tools |
| 145 | }); |
| 146 | ``` |
| 147 | |
| 148 | ## Documentation |
| 149 | |
| 150 | Full documentation with more examples is available in the [Tools API Reference](/reference/sdk-reference/typescript/tools). |