fix: preserve transform_js and rate_limit on http_client tools#563
fix: preserve transform_js and rate_limit on http_client tools#563
Conversation
…i_mcp_servers When http_client tools were extracted from ai_mcp_servers config, the CustomToolDefinition was constructed with only a subset of fields, dropping transform_js and rate_limit. This meant the MCP server's transform_js application code never fired because tool.transform_js was always undefined. This caused disqualified candidates to appear in Workable API list responses despite the workable-api tool having a transform_js filter configured. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR Overview: Fix preserve transform_js and rate_limit on http_client toolsSummaryThis PR fixes a critical bug where Problem DescriptionWhen http_client tools were configured in
Missing fields:
Real-World ImpactThe bug caused disqualified candidates to appear in Workable API list responses despite having a SolutionCore Fix (2 lines added)File: // Preserve transform_js and rate_limit from the original tool config
...(entry.config.transform_js
? { transform_js: entry.config.transform_js as string }
: {}),
...(entry.config.rate_limit
? { rate_limit: entry.config.rate_limit as CustomToolDefinition['rate_limit'] }
: {}),This conditional spread syntax ensures both fields are copied from Additional Changes1. Config Reload Runtime RefactoringNew file: Extracts config reload logic from
Benefits:
2. ConfigWatcher EnhancementFile: Added optional
3. CLI Main SimplificationFile: Replaced inline config watcher setup (36 lines deleted) with: const { setupRunnerConfigReloadRuntime } = await import('./runners/config-reload-runtime');
const configReloadRuntime = await setupRunnerConfigReloadRuntime({...});Cleanup now uses: await configReloadRuntime.cleanup();4. Comprehensive Test CoverageNew file: Tests cover:
Architecture & ImpactComponent Relationshipsgraph TD
A[ai_mcp_servers config] --> B[AICheckProvider.execute]
B --> C[Extract http_client entries]
C --> D[Build CustomToolDefinition]
D --> E{transform_js present?}
D --> F{rate_limit present?}
E --> G[Copy transform_js field]
F --> H[Copy rate_limit field]
G --> I[Register in CustomToolsSSEServer]
H --> I
I --> J[AI calls tool via MCP]
J --> K[mcp-custom-sse-server.ts]
K --> L[executeHttpClientTool]
L --> M[Apply transform_js filter]
L --> N[Apply rate_limit]
M --> O[Filtered response to AI]
N --> O
Data FlowsequenceDiagram
participant Config as ai_mcp_servers config
participant AI as AICheckProvider
participant SSE as CustomToolsSSEServer
participant HTTP as HTTP Client
participant API as External API
Config->>AI: http_client entry with transform_js/rate_limit
AI->>AI: Build CustomToolDefinition (FIX: preserve fields)
AI->>SSE: Register tool with preserved config
AI->>SSE: Start SSE server
Note over AI: AI agent decides to call tool
AI->>SSE: MCP tool call
SSE->>HTTP: Execute HTTP request
HTTP->>API: Apply rate_limit if configured
API->>HTTP: Response data
HTTP->>SSE: Raw response
SSE->>SSE: Apply transform_js if configured
SSE->>AI: Filtered/transformed response
Note over AI: AI receives clean data
Affected System Components
Scope Discovery & ContextDirect Impact
Related Files (for review)Type Definitions:
Execution Logic:
Utilities:
Tests:
Potential Edge Cases
Testing StrategyManual Testing (from PR description)
Automated Testing
ReferencesCode Changes
Related Documentation
Type Definitions
Metadata
Powered by Visor from Probelabs Last updated: 2026-03-24T10:26:05.862Z | Triggered by: pr_opened | Commit: 4739e05 💡 TIP: You can chat with Visor using |
Architecture Issues (1)
Performance Issues (5)
Architecture Issues (1)
Powered by Visor from Probelabs Last updated: 2026-03-24T10:18:46.029Z | Triggered by: pr_opened | Commit: 4739e05 💡 TIP: You can chat with Visor using |
Summary
ai_mcp_serversconfig, theCustomToolDefinitionwas constructed with only a hardcoded subset of fieldstransform_jsandrate_limitwere silently dropped, so the MCP server's transform_js application code never fired (tool.transform_jswas alwaysundefined)workable-apitool having atransform_jsfilter configuredFix
Copy
transform_jsandrate_limitfields fromentry.configwhen constructing theCustomToolDefinitionfor http_client tools (2 lines added inai-check-provider.ts).Test plan
transform_jsis defined onCustomToolDefinitioninterface--no-mocks--no-mocksand verify "Filtered N disqualified candidates" appears in logs🤖 Generated with Claude Code