You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fetch - Fetches a URL from the internet and extracts its contents as markdown.
url (string, required): URL to fetch
max_length (integer, optional): Maximum number of characters to return (default: 5000)
start_index (integer, optional): Start content from this character index (default: 0)
raw (boolean, optional): Get raw content without markdown conversion (default: false)
To Reproduce
Steps to reproduce the behavior:
When I run fetch in LibreChat (Docker) + MCP/Fetch (Docker), I receive the attached errors
Expected behavior
It should disregard optional settings
@claude it looks like the fetch server fails when null is passed to the start_index and max_length arguments. These should be optional parameters. Is this behavior expected?
The behavior you observed is not expected. The fetch server was incorrectly failing when null values were passed for optional parameters.
Root Cause & Solution
Problem: The Pydantic model defined optional parameters as int and bool types with default values, but didn't handle explicit null values from clients like LibreChat. When null was passed, Pydantic tried to validate null as an integer or boolean, causing validation failures.
Fix: Updated the parameter types to Optional[int] and Optional[bool] and added proper null-coalescing logic to use default values when None is received.
Changes made insrc/fetch/src/mcp_server_fetch/server.py:
Added Optional import from typing
Changed max_length: int → max_length: Optional[int]
Changed start_index: int → start_index: Optional[int]
Changed raw: bool → raw: Optional[bool]
Added null-safe handling: args.max_length or 5000, args.start_index or 0, args.raw or False
Todo List
Examine repository structure and locate fetch server code
Check for CLAUDE.md repository guidelines
Analyze the fetch server's parameter validation logic
Determine if null handling for optional parameters is correct
Implement fix for null parameter handling
Test the changes
Status: Fixed! The fetch server now properly handles null values for optional parameters by using their documented default values (max_length: 5000, start_index: 0, raw: false).
Plan: re-do the Optional[int]/Optional[bool] fix from closed PR #2631. Use explicit None checks instead of or coalescing so start_index=0 and raw=False stay respected. Add test coverage per your earlier ask. AI-assisted, human-led, will disclose per CONTRIBUTING.md. Any objection before I open a PR?
Activity
olaservo commentedon Aug 27, 2025
@claude it looks like the fetch server fails when null is passed to the start_index and max_length arguments. These should be optional parameters. Is this behavior expected?
claude commentedon Aug 27, 2025
Claude finished @olaservo's task —— View job •
claude/issue-2035-20250827-1223• Create PR ➔Issue Analysis & Fix
The behavior you observed is not expected. The fetch server was incorrectly failing when
nullvalues were passed for optional parameters.Root Cause & Solution
Problem: The Pydantic model defined optional parameters as
intandbooltypes with default values, but didn't handle explicitnullvalues from clients like LibreChat. Whennullwas passed, Pydantic tried to validatenullas an integer or boolean, causing validation failures.Fix: Updated the parameter types to
Optional[int]andOptional[bool]and added proper null-coalescing logic to use default values whenNoneis received.Changes made in
src/fetch/src/mcp_server_fetch/server.py:Optionalimport from typingmax_length: int→max_length: Optional[int]start_index: int→start_index: Optional[int]raw: bool→raw: Optional[bool]args.max_length or 5000,args.start_index or 0,args.raw or FalseTodo List
Status: Fixed! The fetch server now properly handles
nullvalues for optional parameters by using their documented default values (max_length: 5000, start_index: 0, raw: false).test: add comprehensive tests for null value handling in fetch parame…
rohitg00 commentedon Apr 18, 2026
Plan: re-do the Optional[int]/Optional[bool] fix from closed PR #2631. Use explicit None checks instead of
orcoalescing sostart_index=0andraw=Falsestay respected. Add test coverage per your earlier ask. AI-assisted, human-led, will disclose per CONTRIBUTING.md. Any objection before I open a PR?fix(fetch): accept null for optional parameters
test: add comprehensive tests for null value handling in fetch parame…