Implement code review fixes: type safety, validation, and shared helpers#3
Open
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
Open
Implement code review fixes: type safety, validation, and shared helpers#3devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
Conversation
… and debug logging - Replace 'any' with 'unknown' in WebsetItem interface for type safety - Fix CreateMonitor type mismatch: entity is now object with type field - Add shared HTTP utilities (createAxiosClient, formatApiError) to reduce duplication - Update logger to respect debug flag (no logging when debug=false) - Add metadata length validation (max 1000 chars) in updateWebset and updateEnrichment - Strengthen numeric validation: use z.number().int().min(1) for counts/limits - Add externalId max length validation (300 chars) in createWebset - Update all tool files to use shared helpers and pass debug flag - Early API key validation in createAxiosClient with helpful error message Co-Authored-By: Tanishq Jaiswal <tanishq.jaiswal97@gmail.com>
Contributor
Author
Original prompt from Tanishq |
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement code review fixes: type safety, validation, and shared helpers
Summary
This PR addresses all 15 issues identified in the comprehensive code review of the websets-mcp-server. The changes improve type safety, add proper validation, reduce code duplication through shared utilities, and fix debug logging behavior.
Key changes:
anywithunknownin WebsetItem interface (properties and enrichments fields)entityis now correctly typed as{ type: string }instead ofstringsrc/utils/http.tswithcreateAxiosClient()andformatApiError()to eliminate ~500 lines of duplicate code across 16 tool filesdebug=false(previously always logged).int().min(1)(counts, limits).max(1000)character limit.max(300)character limitcreateAxiosClient()now throws a helpful error immediately if API key is missing, instead of sending empty string to APICode reduction: 19 files changed, 206 insertions(+), 537 deletions(-) (net -331 lines)
Review & Testing Checklist for Human
list_websets. Please manually test at least one create operation (e.g.,create_websetorcreate_search) to ensure the shared HTTP client works correctly for POST requestsdebug=falseis the desired behavior. Previously, logs were always output regardless of the flagcreateAxiosClient()throws an error immediately if the API key is missing, rather than sending an empty string to the API. Verify this doesn't break any existing error handling workflowsanytounknownin WebsetItem is more type-safe but stricter. If there's any consuming code that accesses these properties, it may need updatesTest Plan
list_websets(already tested ✓)create_websetwith searchQuery and enrichmentscreate_searchwith entity and criteria parametersupdate_websetwith metadatadebug: trueanddebug: falseto verify logging behaviorNotes
npm run build✓)ec03f3df-62ff-4aed-a5ea-f5e4d51c68a2-list_websetsworks correctly