fix(agent): ignore empty advanced MCP bindings - #7397
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR treats blank advanced MCP server bindings as inactive while retaining validation errors for missing or non-string server IDs.
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness, security, or repository-rule issues identified. Blank string bindings are consistently removed before MCP discovery in both execution paths, while missing and non-string server IDs continue to fail validation and valid sibling bindings remain unaffected.
|
| Filename | Overview |
|---|---|
| apps/sim/executor/handlers/agent/agent-handler.ts | Filters blank advanced MCP server IDs during tool partitioning so they never reach discovery or provider tool creation. |
| apps/sim/executor/handlers/mothership/mothership-handler.ts | Skips each blank advanced binding within the flat-map expansion while preserving valid sibling bindings and malformed-value errors. |
| apps/sim/lib/mcp/shared.ts | Treats blank string IDs as inactive while continuing to reject missing and non-string IDs and validate active-binding conflicts. |
| apps/sim/executor/handlers/agent/agent-handler.test.ts | Verifies a blank advanced binding causes neither MCP discovery nor provider tool creation. |
| apps/sim/executor/handlers/mothership/mothership-handler.test.ts | Verifies a blank advanced binding is not discovered or forwarded in the Mothership request. |
| apps/sim/lib/mcp/shared.test.ts | Covers blank and whitespace-only inactive bindings while retaining fail-fast coverage for malformed active bindings. |
Reviews (1): Last reviewed commit: "fix(agent): ignore empty advanced MCP bi..." | Re-trigger Greptile
There was a problem hiding this comment.
1 issue found across 6 files
Confidence score: 3/5
- In
apps/sim/lib/mcp/shared.ts,validateToolPermissionsrejects a blank advanced binding beforeformatToolscan ignore it, so workspaces with MCP tools disabled may be unable to run agents; align validation with the inactive-binding behavior and add a regression test.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/sim/lib/mcp/shared.ts">
<violation number="1" location="apps/sim/lib/mcp/shared.ts:55">
P2: When MCP tools are disabled for a workspace, a blank advanced binding now blocks the agent run even though it is intended to be inactive: `validateToolPermissions` sees the advanced entry before `formatTools` ignores it. Filter blank advanced bindings before the permission check, or make the permission check consider only active MCP bindings.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
| if (typeof serverId !== 'string') { | ||
| throw new Error('MCP Server (Advanced) requires params.serverId') | ||
| } | ||
| if (!serverId.trim()) continue |
There was a problem hiding this comment.
P2: When MCP tools are disabled for a workspace, a blank advanced binding now blocks the agent run even though it is intended to be inactive: validateToolPermissions sees the advanced entry before formatTools ignores it. Filter blank advanced bindings before the permission check, or make the permission check consider only active MCP bindings.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/sim/lib/mcp/shared.ts, line 55:
<comment>When MCP tools are disabled for a workspace, a blank advanced binding now blocks the agent run even though it is intended to be inactive: `validateToolPermissions` sees the advanced entry before `formatTools` ignores it. Filter blank advanced bindings before the permission check, or make the permission check consider only active MCP bindings.</comment>
<file context>
@@ -49,9 +49,10 @@ export function assertValidMcpServerToolBindings(value: unknown): void {
+ if (typeof serverId !== 'string') {
throw new Error('MCP Server (Advanced) requires params.serverId')
}
+ if (!serverId.trim()) continue
if (advancedServerIds.has(serverId)) {
throw new Error(`Duplicate MCP Server (Advanced) binding for ${serverId}`)
</file context>
Summary
Type of Change
Testing
Checklist