fetch: map Pydantic ValidationError to INVALID_PARAMS; add robots.txt timeout; tests - #4599
Open
eltypical wants to merge 3 commits into
Open
fetch: map Pydantic ValidationError to INVALID_PARAMS; add robots.txt timeout; tests#4599eltypical wants to merge 3 commits into
eltypical wants to merge 3 commits into
Conversation
…tor parse helper; add robots.txt timeout call_tool previously caught ValueError only, but pydantic>=2 raises ValidationError on model construction. That propagated as an unhandled exception instead of standardized INVALID_PARAMS. - Add parse_fetch_args() catching ValidationError and raising McpError(INVALID_PARAMS) - Use helper in call_tool - Add timeout=15 to robots.txt fetch to avoid hanging on slow sites Signed-off-by: Kiell Tampubolon <yeheskieltampubolon@gmail.com>
…bots.txt timeout - Simulate pydantic ValidationError on Fetch construction and assert INVALID_PARAMS via McpError - Ensure robots.txt fetch passes timeout to AsyncClient.get Signed-off-by: Kiell Tampubolon <yeheskieltampubolon@gmail.com>
Protego.can_fetch expects (user_agent, url). Passing (url, user_agent) could allow or deny erroneously under certain robots.txt, causing CI test failures in the fetch server package. Also retains explicit 15s timeout for robots.txt preflight and centralized Pydantic ValidationError→MCP INVALID_PARAMS mapping. Signed-off-by: Kiell Tampubolon <113831023+eltypical@users.noreply.github.com>
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.
Problem
Fix
Tests
Security/Resilience Impact
Signed-off-by: Kiell Tampubolon yeheskieltampubolon@gmail.com