Skip to content

Commit d41b0be

Browse files
committed
fixup: address Copilot review comments
- Remove duplicate pragma: no cover from raise line in session.py - Strip {e} from OAuth error messages to avoid leaking token data; the chained exception already carries full details for debugging
1 parent d7bacda commit d41b0be

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/mcp/client/auth/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ async def handle_registration_response(response: Response) -> OAuthClientInforma
241241
client_info = OAuthClientInformationFull.model_validate_json(content)
242242
return client_info
243243
except ValidationError as e: # pragma: no cover
244-
raise OAuthRegistrationError(f"Invalid registration response: {e}") from e
244+
raise OAuthRegistrationError("Invalid registration response") from e
245245

246246

247247
def is_valid_client_metadata_url(url: str | None) -> bool:
@@ -334,4 +334,4 @@ async def handle_token_response_scopes(
334334
token_response = OAuthToken.model_validate_json(content)
335335
return token_response
336336
except ValidationError as e: # pragma: no cover
337-
raise OAuthTokenError(f"Invalid token response: {e}") from e
337+
raise OAuthTokenError("Invalid token response") from e

src/mcp/client/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ async def _validate_tool_result(self, name: str, result: types.CallToolResult) -
318318
except ValidationError as e:
319319
raise RuntimeError(f"Invalid structured content returned by tool {name}: {e}") from e
320320
except SchemaError as e: # pragma: no cover
321-
raise RuntimeError(f"Invalid schema for tool {name}: {e}") from e # pragma: no cover
321+
raise RuntimeError(f"Invalid schema for tool {name}: {e}") from e
322322

323323
async def list_prompts(self, *, params: types.PaginatedRequestParams | None = None) -> types.ListPromptsResult:
324324
"""Send a prompts/list request.

0 commit comments

Comments
 (0)