Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions app/mcp_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,14 @@ def optional_clean_str_arg(field: str) -> str | None:
return clean or None

def output_format_arg() -> str:
value = args.get("format", "text")
if value is None:
if "format" not in args:
return "text"
value = args["format"]
if not isinstance(value, str):
raise ValueError("format must be a string")
normalized = value.strip().lower()
if normalized not in {"text", "json"}:
if value not in {"text", "json"}:
raise ValueError("format must be text or json")
return normalized
return value

def optional_repo_selector_arg() -> str | None:
repo = optional_clean_str_arg("repo")
Expand Down
3 changes: 3 additions & 0 deletions tests/test_api_mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1810,10 +1810,13 @@ def test_mcp_submit_work_proof_scopes_issue_number_by_repo(sqlite_url: str) -> N
({"bounty_id": 1, "issue_number": 1}, 25),
({"format": "xml"}, 26),
({"format": 1}, 27),
({"format": None}, 28),
({"repo": "ramimbo/mergework"}, 29),
({"bounty_id": 1, "repo": "ramimbo/mergework"}, 30),
({"issue_number": 1, "repo": 1}, 31),
({"issue_number": 1, "repo": "a" * 201}, 32),
({"format": "JSON"}, 33),
({"format": " json "}, 34),
],
)
def test_mcp_submit_work_proof_rejects_invalid_bounty_selectors(
Expand Down
Loading