fix(mcp): Remove redundant exception handling and unnecessary str() cast

- client.py: except (ValueError, Exception) → except Exception
  (Exception already catches ValueError, so it's redundant)
- oauth.py: SecretStr(str(tokens[...])) → SecretStr(tokens[...])
  (refresh_token is already a string, no cast needed)
This commit is contained in:
Otto
2026-02-09 08:40:58 +00:00
parent e59e8dd9a9
commit 7c9e47ba76
2 changed files with 2 additions and 2 deletions

View File

@@ -139,7 +139,7 @@ class MCPClient:
else:
try:
body = response.json()
except (ValueError, Exception) as e:
except Exception as e:
raise MCPClientError(
f"MCP server returned non-JSON response: {e}"
) from e

View File

@@ -167,7 +167,7 @@ class MCPOAuthHandler(BaseOAuthHandler):
title=credentials.title,
access_token=SecretStr(tokens["access_token"]),
refresh_token=(
SecretStr(str(tokens["refresh_token"]))
SecretStr(tokens["refresh_token"])
if tokens.get("refresh_token")
else credentials.refresh_token
),