Skip to content
Merged
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
36 changes: 34 additions & 2 deletions app/mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,40 @@
"name": "submit_wallet_transfer",
"description": "Submit a signed MRWK wallet transfer",
},
{"name": "get_ledger_entry", "description": "Get a ledger entry"},
{"name": "get_proof", "description": "Get a public proof by hash"},
{
"name": "get_ledger_entry",
"description": "Get a ledger entry by immutable ledger sequence",
"inputSchema": {
"type": "object",
"properties": {
"sequence": {
"type": "integer",
"minimum": 1,
"description": "Immutable public ledger sequence number.",
},
},
"required": ["sequence"],
"additionalProperties": False,
},
},
{
"name": "get_proof",
"description": "Get a public proof by hash",
"inputSchema": {
"type": "object",
"properties": {
"hash": {
"type": "string",
"pattern": "^[0-9a-fA-F]{64}$",
"description": (
"Public proof hash returned by ledger, activity, or bounty APIs."
),
},
},
"required": ["hash"],
"additionalProperties": False,
},
},
{
"name": "submit_work_proof",
"description": (
Expand Down
4 changes: 4 additions & 0 deletions docs/agent-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ Tools:
- `submit_work_proof` (`format: "json"` returns structuredContent; `tools/list`
advertises the selector and format schema)

`tools/list` advertises required selector schemas for proof and ledger lookups:
`get_proof` requires a 64-character proof `hash`, and `get_ledger_entry`
requires a positive integer `sequence`.

Successful MCP tools that return JSON objects or lists include both the
backward-compatible JSON string in `result.content[0].text` and parsed
`result.structuredContent`. Prefer `structuredContent` when present, and fall
Expand Down
12 changes: 12 additions & 0 deletions tests/test_api_mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,18 @@ def test_mcp_tools_list_and_call(sqlite_url: str) -> None:
assert balance_schema["additionalProperties"] is False
assert balance_schema["properties"]["account"]["minLength"] == 1
assert "github:<login>" in balance_schema["properties"]["account"]["description"]
ledger_tool = next(
tool for tool in tools["result"]["tools"] if tool["name"] == "get_ledger_entry"
)
ledger_schema = ledger_tool["inputSchema"]
assert ledger_schema["required"] == ["sequence"]
assert ledger_schema["additionalProperties"] is False
assert ledger_schema["properties"]["sequence"]["minimum"] == 1
proof_tool = next(tool for tool in tools["result"]["tools"] if tool["name"] == "get_proof")
proof_schema = proof_tool["inputSchema"]
assert proof_schema["required"] == ["hash"]
assert proof_schema["additionalProperties"] is False
assert proof_schema["properties"]["hash"]["pattern"] == "^[0-9a-fA-F]{64}$"

balance = client.post(
"/mcp",
Expand Down
Loading