fix(agent): unique tool ids for multi-instance tools + icon updates#4933
Conversation
Multi-instance agent tools (table, knowledge base, workflow) get a unique id by suffixing the resource id (e.g. table_query_rows_<tableId>). The suffix code read the canonical param key (tableId/knowledgeBaseId) directly from stored params, but selector subblocks persist their value under the subblock id (tableSelector/knowledgeBaseSelector). Tools stored in that state never got a suffix, so two of them collapsed to the same name. Resolve the canonical resource id from the source subblock first — mirroring the execution-time paramsTransform — so the unique id is derived the same way the tool actually runs. Non-destructive; no-op when the canonical key is already present.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryLow Risk Overview Also updates integration visuals: 1Password gets a full-color icon and white block/docs background; Prospeo and Neo4j icons are slightly scaled up via centered SVG transforms. Unit tests cover table and knowledge-base ID resolution paths. Reviewed by Cursor Bugbot for commit 0538f39. Configure here. |
Greptile SummaryThis PR fixes a bug where multi-instance agent tools (table, knowledge-base, workflow) could produce duplicate LLM tool names when the resource ID was stored under a selector subblock key (e.g.
Confidence Score: 5/5Safe to merge — the fix is surgical, non-destructive, and fully tested. The canonical-ID resolution logic is a shallow, non-destructive copy operation that only adds the canonical key to a temporary object used for building the tool-ID suffix; it does not touch userProvidedParams or the paramsTransform that drives actual execution. The change is a no-op for the ~90% of tools that already carry the canonical key directly. The eight new unit tests cover all four selector modes for both table and knowledge-base blocks, and the previously flagged gap (missing knowledge-base coverage) has been addressed in this PR. Icon and metadata changes are cosmetic with no runtime impact. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[transformBlockTool called] --> B[Resolve toolId from block config]
B --> C[Build canonicalGroups from subBlocks]
C --> D[resolveCanonicalResourceParams]
D --> E{Canonical key already in params?}
E -- Yes --> F[Keep existing value]
E -- No --> G[getCanonicalValues from selector subblock keys]
G --> H{canonicalMode?}
H -- basic --> I[Use basicValue e.g. tableSelector]
H -- advanced --> J[Use advancedValue e.g. manualTableId]
I --> K[Set canonical key in resolvedResourceParams]
J --> K
F --> L[Build uniqueToolId suffix]
K --> L
L --> M{Tool type?}
M -- workflow_executor --> N[suffix = workflowId]
M -- knowledge_* --> O[suffix = knowledgeBaseId]
M -- table_* --> P[suffix = tableId]
M -- other --> Q[no suffix]
N & O & P & Q --> R[Return tool config with paramsTransform for execution]
Reviews (2): Last reviewed commit: "improvement(icons): new 1Password icon o..." | Re-trigger Greptile |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 0538f39. Configure here.
Summary
tableSelector) instead of the canonical key (tableId). Two such tools collapsed to the same name and Anthropic rejected the request withTool names must be unique.resolveCanonicalResourceParams, which mirrors the execution-timeparamsTransformto resolve the canonical resource id from its basic/advanced selector source before the unique-id suffix is built — so the suffix matches the params the tool actually runs with.canonicalGroupscomputation earlier intransformBlockToolso it serves both the new resolution step and the existingparamsTransform.bgColorto white; slightly enlarged the Prospeo and Neo4j glyphs via a centered scale transform (no crop, no shift). Regenerated docs/integration metadata.Type of Change
Testing
transformBlockToolcovering table and knowledge-base selector resolution (basic-selector, advanced-manual, already-canonical, no-selection)bunx vitest run providers/utils.test.ts executor/handlers/agent/agent-handler.test.ts— all passingChecklist