feat(arena/mcp): Arena Toolkit Phase 1 — 16 MCP tools + OWNER_KEYS#37
Closed
xmujx wants to merge 10 commits into
Closed
feat(arena/mcp): Arena Toolkit Phase 1 — 16 MCP tools + OWNER_KEYS#37xmujx wants to merge 10 commits into
xmujx wants to merge 10 commits into
Conversation
…/arena skill Phase 1 (fully wired, works now): - 4 verb tools: arena_sell, arena_move, arena_freeze, arena_roll - 2 keeper tools: arena_run_matchmaking, arena_force_settle (OWNER_KEYS gated) - OWNER_KEYS env parsing in both stdio and HTTP entry points - Agent runner selfTools + system prompt updated with new verbs Phase 2 (scaffolded, awaiting #32 GTreasury/CardLedger + #33 Tier): - 10 tool registrations with full zod schemas and descriptions - chain.ts: ABI stubs for GTreasury + CardLedger + Tier - chain.ts: method stubs with typed signatures (throw until contracts deployed) - Wiring checklist: resolve contracts from Router.getAddressesV3() in ready() Claude Code skill: - .claude/commands/arena.md — /arena slash command with workflow guide + strategy Closes Phase 1 of #35. Phase 2 unblocks when #32 and #33 merge.
List all 21 arena tools in the skill reference, grouped by category. Phase 2 tools (G currency, market, tier) marked with issue refs. Added market and tier workflow sections.
New tools: - arena_simulate_match: full turn-by-turn combat replay - arena_preview_elo: preview ELO delta without committing - arena_get_card: single card details (#32) - arena_set_matchmaking_period: owner-only tier cooldown (#33) Docs: - docs/arena-guide.md: complete agent gameplay guide covering card flow, 12 units, combat mechanics, ability timing, 3 archetypes, positioning strategy, tier system, secondary market, and full tool reference - Updated /arena skill with new tools
- skill.md: add condensed Arena section (card flow, combat, units, strategy, tool table, tier system) for agent system prompt - CLAUDE.md: add Arena entry with link to docs/arena-guide.md - docs/arena-guide.md kept as the complete reference - .claude/commands/arena.md: add simulate_match, preview_elo, get_card, set_matchmaking_period to tool table
Collaborator
|
里面g的默认数值我觉得都可以x100 倍,现在有点少 |
Contributor
Author
去掉了prompt 的硬编码数值,这些都在合约里定义的,到时候让他直接从合约取 |
This was referenced Jun 4, 2026
Contributor
Author
|
Replaced by #51 — same content rebased onto latest main with all ABI conflicts resolved |
xmujx
added a commit
that referenced
this pull request
Jun 4, 2026
…37) (#51) * feat(arena/mcp): Arena Toolkit Phase 1 — 16 MCP tools + OWNER_KEYS + /arena skill Phase 1 (fully wired, works now): - 4 verb tools: arena_sell, arena_move, arena_freeze, arena_roll - 2 keeper tools: arena_run_matchmaking, arena_force_settle (OWNER_KEYS gated) - OWNER_KEYS env parsing in both stdio and HTTP entry points - Agent runner selfTools + system prompt updated with new verbs Phase 2 (scaffolded, awaiting #32 GTreasury/CardLedger + #33 Tier): - 10 tool registrations with full zod schemas and descriptions - chain.ts: ABI stubs for GTreasury + CardLedger + Tier - chain.ts: method stubs with typed signatures (throw until contracts deployed) - Wiring checklist: resolve contracts from Router.getAddressesV3() in ready() Claude Code skill: - .claude/commands/arena.md — /arena slash command with workflow guide + strategy Closes Phase 1 of #35. Phase 2 unblocks when #32 and #33 merge. * docs: add Phase 2 tools to /arena skill List all 21 arena tools in the skill reference, grouped by category. Phase 2 tools (G currency, market, tier) marked with issue refs. Added market and tier workflow sections. * fix: align Phase 2 stubs with PR #39 and #40 actual implementations * test: add E2E script for arena MCP tools (24/24 pass on fresh chain) * feat(arena/mcp): add missing tools + arena gameplay guide New tools: - arena_simulate_match: full turn-by-turn combat replay - arena_preview_elo: preview ELO delta without committing - arena_get_card: single card details (#32) - arena_set_matchmaking_period: owner-only tier cooldown (#33) Docs: - docs/arena-guide.md: complete agent gameplay guide covering card flow, 12 units, combat mechanics, ability timing, 3 archetypes, positioning strategy, tier system, secondary market, and full tool reference - Updated /arena skill with new tools * docs: arena guide in skill.md + CLAUDE.md entry link - skill.md: add condensed Arena section (card flow, combat, units, strategy, tool table, tier system) for agent system prompt - CLAUDE.md: add Arena entry with link to docs/arena-guide.md - docs/arena-guide.md kept as the complete reference - .claude/commands/arena.md: add simulate_match, preview_elo, get_card, set_matchmaking_period to tool table * test: add full arena E2E script (requires #39 contracts) * fix: replace ore refs with G, remove hardcoded prices in arena descriptions * fix: remove hardcoded tier thresholds, make owner-configurable * fix: remove stale arena_sell/freeze/roll tools and old ABI entries These were from the pre-persistent-card era and don't exist in the current ArenaEngine contract. * fix: sync MCP ABI with tier-based matchmaking contracts, remove duplicate code - ARENA_ENGINE_ABI: GhostSubmitted/runMatchmaking/MatchmadeInTier use uint8 tier (was uint16 bucket — different selector/topic hash, calls reverted silently) - G_TREASURY_ABI: use creditG (onlyOperator) instead of fundAgentG (onlyOwner) - Delete duplicate G_TREASURY_ABI, CARD_LEDGER_ABI const declarations - Delete Phase 2 stubs section (~150 lines of duplicate methods + throw stubs) - Delete 7 duplicate tool registrations in tools.ts - Wire fund_agent_g, arena_get_tier_info, arena_withdraw_submission, arena_set_matchmaking_period as working implementations - Net -306 lines, 0 TS errors * feat: add arena_deposit_g tool from PR #52 GTreasury.depositG(agentId) payable — lets agent owners deposit native testnet tokens into their Arena G balance. Adds ABI entry, chain method, and MCP tool. * docs: sync arena guide and skill.md with current tool names - Core loop: add arena_deposit_g, remove deleted tools (sell/move/freeze/roll) - Tool tables: arena_fund_g → fund_agent_g, bucket_id → tier, remove stale entries - skill.md: update card flow and tool roster * refactor: consolidate admin tools into gated section with [ADMIN] prefix Move set_oracle_agent, fund_agent_g, arena_set_matchmaking_period into a single admin block with isOwnerCall() guards and [ADMIN] description prefix. Update arena-guide.md and skill.md to match. * fix: remove duplicate arenaDepositG from merge * docs: add missing arena_cancel_listing and arena_get_card to skill.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
arena_sell,arena_move,arena_freeze,arena_roll+ 2 keeper tools (arena_run_matchmaking,arena_force_settle) withOWNER_KEYSenv gatingbuyer_agent_iddefault forarena_buy_listing.claude/commands/arena.mdwith card flow diagramdocs/arena-guide.md(complete) +skill.md(condensed for agent prompt)mcp-server/scripts/e2e-arena-tools.mjs+e2e-arena-full.mjsCard Flow (aligned with #39)
All 27 Arena MCP Tools
arena_list_units,arena_get_state,arena_buy,arena_submit,arena_get_recent_matchesarena_sell,arena_move,arena_freeze,arena_roll,arena_run_matchmaking,arena_force_settlearena_simulate_match,arena_preview_elo,arena_get_card,arena_set_matchmaking_periodarena_get_g_balance,arena_fund_g,arena_list_inventory,arena_list_market,arena_place_listing,arena_cancel_listing,arena_buy_listing,arena_place_card,arena_remove_cardarena_view_deck,arena_get_tier_info,arena_withdraw_submissionTest Results
1. Phase 1 E2E: 24/24 PASS
Tested on spike contracts (Anvil). All Phase 1 tools real on-chain tx. Phase 2 tools graceful "not deployed yet" errors.
2. Contract Verification: ALL PASS (PR #40 branch, includes #39)
Tested on
feat/arena-tierbranch deployed to Anvil (--code-size-limit 50000). This branch contains both #32 (card market) and #33 (tier) code.#32 Card Market:
buy(2, Stoneguard)→ inventorygetOwnedCards(2)placeCard(2, 8, slot0)getGhostCards(2)removeCard(2, slot0)→ inventorylistCard(2, 8, 25G)getActiveListings(0,10)cancelListing(2, 8)buyListed(3, 8, 25G)#33 Tier:
_tierFor(2)[47G]_tierFor(3)[475G]runMatchmaking(Silver)settleMatch(1)withdrawSubmission(2)Spike verbs:
freeze/rollpreviewEloUpdate(1016,984)sell(empty slot)#39 own E2E: 16/16 PASS — full buy→inventory→bench→market→buyer chain verified.
Note on contract size
ArenaEngine after #39+#40 merge is 25318 bytes (> 24576 limit). Local testing uses
anvil --code-size-limit 50000. Production deploy needs--via-iroptimization or library extraction before testnet deploy.Wiring Checklist (after #40 merges)
ChainClient.ready(): resolvegTreasury+cardLedgerfrom RoutergetAddressesV3()(index 7/8)placeCard,removeCard,getGhostCards, tier functionsarena_get_stateto returngBalanceinstead oforerunMatchmakingtool: add tier overload (runMatchmaking(uint8)for tier-based matching)Partial impl of #35. Phase 2 unblocks when #40 merges.