Advertise submit_work_proof MCP input schema#345
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughWiden MCP_TOOLS typing to allow non-string metadata and add explicit input validation to the submit_work_proof MCP tool (numeric selectors, format enum/default, no extra properties, and a mutual-selector constraint). Tests and docs updated to reflect the schema. ChangesMCP Tool Schema and Validation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/mcp.py`:
- Around line 42-66: The inputSchema currently allows both bounty_id and
issue_number simultaneously though submit_work_proof rejects that; update the
JSON Schema for inputSchema to enforce mutual exclusion (e.g., use oneOf/anyOf
with required sets or a not+required combination) so only one of "bounty_id" or
"issue_number" is allowed; specifically modify the schema object containing
"properties" and "additionalProperties" (the inputSchema definition) to include
a top-level constraint (oneOf/anyOf or a not with required) that references the
"bounty_id" and "issue_number" property names to align runtime behavior with
validation.
In `@tests/test_api_mcp.py`:
- Around line 433-438: Add an assertion to the existing test that verifies the
advertised input schema disallows providing both selectors at once: after the
current assertions on submit_schema, assert that submit_schema["not"] ==
{"required": ["bounty_id", "issue_number"]} (i.e., check the submit_schema
variable in tests/test_api_mcp.py to enforce selector exclusivity).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 5af98161-35c8-4ab2-8bd6-68525fa6bb6e
📒 Files selected for processing (3)
app/mcp.pydocs/agent-guide.mdtests/test_api_mcp.py
tolga-tom-nook
left a comment
There was a problem hiding this comment.
No blockers found.
Evidence checked:
- Inspected
app/mcp.py,tests/test_api_mcp.py, anddocs/agent-guide.mdagainst currentorigin/main. - Verified the new
submit_work_proofinputSchemaadvertisesbounty_id,issue_number, andformatwithtext/jsonenum plusadditionalProperties: falsewithout changing the tool-call response path. - Verified docs mention the structured JSON path and schema discovery.
- Ran:
./.venv/bin/python -m pytest tests/test_api_mcp.py::test_mcp_tools_list_and_call tests/test_api_mcp.py::test_mcp_submit_work_proof_returns_structured_bounty_guidance tests/test_api_mcp.py::test_mcp_submit_work_proof_returns_structured_generic_guidance tests/test_api_mcp.py::test_mcp_submit_work_proof_rejects_invalid_bounty_selectors -q-> 10 passed. - Ran:
./.venv/bin/python -m ruff check app/mcp.py tests/test_api_mcp.py docs/agent-guide.md-> passed. - Ran:
./.venv/bin/python -m mypy app-> passed. - Ran:
./.venv/bin/python scripts/docs_smoke.py-> docs smoke ok. - Ran:
git diff --check origin/main...HEAD-> clean.
TateLyman
left a comment
There was a problem hiding this comment.
Requested changes: the advertised MCP schema still permits an argument object with both bounty_id and issue_number, while the actual submit_work_proof runtime rejects that same combination as ambiguous. That makes tools/list discovery over-advertise a call shape agents cannot successfully use.
Evidence checked:
- Inspected
app/mcp.py,tests/test_api_mcp.py, anddocs/agent-guide.mdon this PR. submit_work_proofnow advertisesbounty_id,issue_number, andformat, withadditionalProperties: false, but the schema has no top-levelnot/oneOf/ equivalent selector-exclusivity constraint.- Existing runtime regression still rejects
{"bounty_id": 1, "issue_number": 1}intest_mcp_submit_work_proof_rejects_invalid_bounty_selectors, so the published schema and runtime contract disagree.
Validation:
uv run --extra dev python -m pytest tests/test_api_mcp.py::test_mcp_tools_list_and_call tests/test_api_mcp.py::test_mcp_submit_work_proof_rejects_invalid_bounty_selectors -q-> 8 passed.uv run --extra dev ruff check app/mcp.py tests/test_api_mcp.py docs/agent-guide.md-> passed.uv run --extra dev ruff format --check app/mcp.py tests/test_api_mcp.py-> passed. Note: includingdocs/agent-guide.mdinruff format --checkfails locally because Markdown formatting is experimental without preview mode, not because of this PR's content.uv run --extra dev python -m mypy app/mcp.py-> passed.uv run --extra dev python scripts/docs_smoke.py-> docs smoke ok.git diff --check origin/main...HEAD-> clean.
Patch order: add a top-level selector exclusivity constraint to the submit_work_proof inputSchema, then assert it in test_mcp_tools_list_and_call so tools/list matches runtime behavior.
847d046 to
ada0259
Compare
|
Updated PR #345 for the requested schema/runtime mismatch. Changed:
Validation:
|
TateLyman
left a comment
There was a problem hiding this comment.
Rechecked the follow-up commit and the schema/runtime mismatch I flagged is fixed.
What changed:
submit_work_proofinputSchemanow includesnot: {"required": ["bounty_id", "issue_number"]}.test_mcp_tools_list_and_callnow asserts that selector-exclusivity constraint.- Runtime behavior still rejects ambiguous selector calls, so the advertised MCP schema now matches the route behavior.
Validation:
uv run --extra dev python -m pytest tests/test_api_mcp.py::test_mcp_tools_list_and_call tests/test_api_mcp.py::test_mcp_submit_work_proof_rejects_invalid_bounty_selectors -q-> 8 passed.uv run --extra dev ruff check app/mcp.py tests/test_api_mcp.py docs/agent-guide.md-> passed.uv run --extra dev ruff format --check app/mcp.py tests/test_api_mcp.py-> passed.uv run --extra dev python -m mypy app/mcp.py-> passed.uv run --extra dev python scripts/docs_smoke.py-> docs smoke ok.git diff --check origin/main...HEAD-> clean.- GitHub mergeState
CLEAN; hosted quality check and CodeRabbit are green.
TUPM96
left a comment
There was a problem hiding this comment.
No blockers from my pass on current head ada02590f78df1f3ec46b8a1f86ad1c78aeb52d3.
Evidence checked:
- Inspected
app/mcp.py,tests/test_api_mcp.py, anddocs/agent-guide.md. - Rechecked the earlier schema/runtime mismatch:
submit_work_proofnow advertisesbounty_id,issue_number, andformat, rejects additional properties, and includesnot: {required: [bounty_id, issue_number]}so the MCPtools/listschema matches the runtime selector exclusivity test. - Verified docs mention structured JSON guidance and schema discovery without changing existing tool-call behavior.
- GitHub reports mergeState
CLEAN; hosted quality check and CodeRabbit are green.
Validation:
uv run --extra dev python -m pytest tests/test_api_mcp.py::test_mcp_tools_list_and_call tests/test_api_mcp.py::test_mcp_submit_work_proof_rejects_invalid_bounty_selectors tests/test_api_mcp.py::test_mcp_submit_work_proof_returns_structured_bounty_guidance tests/test_api_mcp.py::test_mcp_submit_work_proof_returns_structured_generic_guidance -q-> 10 passed.uv run --extra dev python -m pytest tests/test_api_mcp.py -q-> 76 passed.uv run --extra dev ruff check app/mcp.py tests/test_api_mcp.py docs/agent-guide.md-> passed.uv run --extra dev ruff format --check app/mcp.py tests/test_api_mcp.py-> passed.uv run --extra dev python -m mypy app/mcp.py-> passed.uv run --extra dev python scripts/docs_smoke.py-> docs smoke ok.git diff --check origin/main...HEAD-> clean.
Summary
inputSchemaforsubmit_work_proofintools/list.bounty_id,issue_number, andformatwith thetext/jsonenum so agents can discover structured guidance without hard-coded arguments.submit_work_proofcall behavior.Why this is distinct
PR #317 and PR #339 added structured guidance output and availability state. This PR makes that contract discoverable through MCP tool metadata, so clients can learn the selector and format fields from
tools/listbefore calling the tool.Test Evidence
uv run --extra dev python -m pytest tests/test_api_mcp.py::test_mcp_tools_list_and_call tests/test_api_mcp.py::test_mcp_submit_work_proof_returns_structured_bounty_guidance tests/test_api_mcp.py::test_mcp_submit_work_proof_returns_structured_generic_guidance tests/test_api_mcp.py::test_mcp_submit_work_proof_rejects_invalid_bounty_selectors -q-> 10 passed.uv run --extra dev python -m pytest -q-> 332 passed.uv run --extra dev ruff check .-> passed.uv run --extra dev ruff format --check .-> 46 files already formatted.uv run --extra dev python -m mypy app-> success.uv run --extra dev python scripts/docs_smoke.py-> docs smoke ok.git diff --check-> clean.MRWK
Bounty #315
No private keys, seed material, secrets, deployment credentials, private vulnerability details, payout credentials, or MRWK price claims are included.
Summary by CodeRabbit
Improvements
Documentation