Skip to content

Add get_balance MCP input schema#937

Merged
ramimbo merged 1 commit into
ramimbo:mainfrom
catcherintheroad-hub:codex/mcp-get-balance-schema-844
Jun 5, 2026
Merged

Add get_balance MCP input schema#937
ramimbo merged 1 commit into
ramimbo:mainfrom
catcherintheroad-hub:codex/mcp-get-balance-schema-844

Conversation

@catcherintheroad-hub
Copy link
Copy Markdown

@catcherintheroad-hub catcherintheroad-hub commented Jun 5, 2026

Summary

  • Add inputSchema metadata for the existing get_balance MCP tool.
  • Document the required account selector shape in tools/list so agents can discover it before calling the tool.
  • Extend the existing MCP tools/list test while preserving current get_balance runtime behavior and response text.

Bounty scope / duplicate check

Bounty #844.

This is a focused MCP schema/usability improvement for a read-only tool. Existing useful open #844 work covers get_balance structured output (#885), selector description wording (#891), broad/stale input-schema work (#738), list_bounties argument guards (#892), proof/bounty/attempt aliases, and wallet schema work (#926). This PR only adds machine-readable inputSchema metadata for the existing get_balance.account argument and does not change the dispatcher, balance calculation, response shape, or wallet/ledger/treasury behavior.

Validation

  • uv run --python 3.12 --extra dev python -m pytest tests/test_api_mcp.py::test_mcp_tools_list_and_call tests/test_api_mcp.py::test_wallet_account_views_normalize_mixed_case_addresses tests/test_api_mcp.py::test_github_account_views_normalize_mixed_case_logins -q -> 3 passed, 1 existing Starlette/httpx warning
  • uv run --python 3.12 --extra dev python -m pytest tests/test_api_mcp.py tests/test_mcp_tools.py -q -> 112 passed, 1 existing Starlette/httpx warning
  • uv run --python 3.12 --extra dev ruff check app/mcp.py tests/test_api_mcp.py -> passed
  • uv run --python 3.12 --extra dev ruff format --check app/mcp.py tests/test_api_mcp.py -> 2 files already formatted
  • uv run --python 3.12 --extra dev mypy app/mcp.py -> success
  • uv run --python 3.12 --extra dev python scripts/docs_smoke.py -> docs smoke ok
  • git diff --check origin/main...HEAD -> clean
  • git merge-tree --write-tree origin/main HEAD -> clean

Summary by CodeRabbit

  • Bug Fixes

    • Strengthened input validation for balance queries by introducing an explicit schema: required account field, minimum length, and disallowing extra properties.
  • Tests

    • Expanded test coverage for the balance tool schema, verifying required fields, length constraints, and prevention of additional properties.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 08fb506d-7f12-4830-a5c2-e5d7057ea546

📥 Commits

Reviewing files that changed from the base of the PR and between 9a75108 and 5dca8b1.

📒 Files selected for processing (2)
  • app/mcp.py
  • tests/test_api_mcp.py

📝 Walkthrough

Walkthrough

The get_balance MCP tool definition in MCP_TOOLS is expanded to include an inputSchema that specifies a required account field (minimum length 1, string type) and disallows additional properties. Test coverage is updated to validate the schema structure, required fields, minimum length constraint, and expected account description text.

Changes

get_balance tool input schema

Layer / File(s) Summary
Tool input schema definition and validation
app/mcp.py, tests/test_api_mcp.py
get_balance tool in MCP_TOOLS is expanded to include an inputSchema requiring account (string, minimum length 1) with additionalProperties: False. Test assertions validate the schema structure, required fields, minimum constraint, and account field description including github:<login> guidance.

Possibly related issues

Possibly related PRs

  • ramimbo/mergework#398: Modifies/validates get_balance dispatcher arguments and tests, overlapping on the same tool contract.
  • ramimbo/mergework#345: Updates MCP tool registry and tests for a different tool but similar registry/test patterns.
🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and concretely names the primary changed surface: adding input schema metadata to the get_balance MCP tool.
Description check ✅ Passed The description covers all required template sections with concrete details: summary of changes, bounty/scope clarification, validation evidence, and test results demonstrating no regressions.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Mergework Public Artifact Hygiene ✅ Passed No investment, price, cash-out, or payout claims found. MRWK correctly described as native project coin supporting future snapshots/bridges pending discussion.
Bounty Pr Focus ✅ Passed Diff matches stated files. PR adds get_balance inputSchema with account field, includes 4 test assertions, preserves runtime behavior, and avoids unrelated changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@catcherintheroad-hub catcherintheroad-hub force-pushed the codex/mcp-get-balance-schema-844 branch from 9a75108 to 5dca8b1 Compare June 5, 2026 09:38
@catcherintheroad-hub
Copy link
Copy Markdown
Author

Update after rebasing onto current origin/main.

Current head: 5dca8b12685d472bb37b78fe0654b9b57d68dd22.

The earlier Bounty Pr Focus warning was from the previous head/base comparison. After rebase, the PR diff is limited to the intended two files:

  • app/mcp.py
  • tests/test_api_mcp.py

Updated validation on the rebased head:

  • uv run --python 3.12 --extra dev python -m pytest tests/test_api_mcp.py::test_mcp_tools_list_and_call tests/test_api_mcp.py tests/test_mcp_tools.py -q -> 115 passed, 1 existing Starlette/httpx warning.
  • uv run --python 3.12 --extra dev ruff check app/mcp.py tests/test_api_mcp.py -> passed.
  • uv run --python 3.12 --extra dev ruff format --check app/mcp.py tests/test_api_mcp.py -> 2 files already formatted.
  • uv run --python 3.12 --extra dev mypy app/mcp.py -> success.
  • uv run --python 3.12 --extra dev python scripts/docs_smoke.py -> docs smoke ok.
  • git diff --check origin/main...HEAD -> clean.
  • git merge-tree --write-tree origin/main HEAD -> clean tree 617107ad59799161c468ec974aa5102af40f6ec7.

Hosted Quality/readiness/docs/image is successful on this rebased head. CodeRabbit is still pending its latest run at the time of this note.

@catcherintheroad-hub
Copy link
Copy Markdown
Author

Final status update after the rebased CodeRabbit run completed: CodeRabbit is now SUCCESS on head 5dca8b12685d472bb37b78fe0654b9b57d68dd22, with no actionable comments. The PR is mergeable and mergeStateStatus: CLEAN; hosted CI remains successful. The current diff is still limited to app/mcp.py and tests/test_api_mcp.py.

Copy link
Copy Markdown
Contributor

@szx19970521 szx19970521 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed current head 5dca8b12685d472bb37b78fe0654b9b57d68dd22.

Evidence checked:

  • inspected app/mcp.py and tests/test_api_mcp.py;
  • confirmed this only adds tools/list inputSchema metadata for the existing read-only get_balance tool;
  • confirmed the schema requires the existing account selector, disallows extra properties at the advertised MCP schema level, and documents the same account forms already accepted by runtime normalization;
  • confirmed the dispatcher/runtime path for get_balance remains unchanged in app/mcp_tools.py, so response text, balance calculation, wallet/GitHub account normalization, ledger state, treasury behavior, payout behavior, wallet registration/transfer signing, admin-token behavior, private data, exchange, bridge, cash-out, and MRWK price behavior are not changed.

Validation run locally on a clean temp checkout with the PR head files applied:

  • python -m pytest tests/test_api_mcp.py::test_mcp_tools_list_and_call tests/test_api_mcp.py::test_wallet_account_views_normalize_mixed_case_addresses tests/test_api_mcp.py::test_github_account_views_normalize_mixed_case_logins -q -> 3 passed, 1 existing Starlette/httpx warning
  • python -m ruff check app/mcp.py tests/test_api_mcp.py -> passed
  • python -m ruff format --check app/mcp.py tests/test_api_mcp.py -> 2 files already formatted
  • python -m mypy app/mcp.py -> success
  • python scripts/docs_smoke.py -> docs smoke ok

GitHub state checked before review: PR open, mergeable clean, and no human reviews visible on current head.

No blocker found for this focused MCP schema/usability change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mrwk:accepted Maintainer accepted for payout mrwk:paid Ledger payment recorded

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants