Skip to content

feat(mcp): add assets inspection and hot-reload tools - #712

Merged
houko merged 3 commits into
mainfrom
feat/mcp-assets-hotreload-469
Nov 24, 2026
Merged

houko merged 3 commits into
mainfrom
feat/mcp-assets-hotreload-469

Conversation

@houko

@houko houko commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add game_assets_list, game_asset_reload, and game_assets_reload_group MCP tools in packages/game/mcp/assets.go with strict DisallowUnknownFields() decoding, JSON schemas, deterministic sorting, and hookup in packages/game/mcp/mcp.go after the inspect, loop, input, console, edit, replay and perf tools.
  • Add read-only group inspection and memory estimation (Manager.Disposed, Manager.GroupNames, Manager.LookupGroup, Manager.GroupStats, Group.Stats, EstimateAtlasBytes) plus in-place Manager.ReloadAsset and Manager.ReloadGroup in packages/game/assets. Reads, atlas parses and custom loaders run off the engine goroutine, as Group.Load does; the results are applied on the engine goroutine, so reloading an atlas updates existing *sprite.Atlas pointers and triggers redraws via Manager.Revision().
  • Sounds, images with no file behind them and files at a density the screen does not show are reported as skipped rather than reloaded or failed.
  • Add ReloadFile / ReloadShaderFile / ReloadMaterialFile and path getters in packages/game/resource and packages/game/tooling/hotreload, plus Bridge.RegisterAsset, Bridge.RegisterAtlas, and Config.ReloadAsset fallback support for single keys.
  • Surface parse/schema/compile errors as structured reload results (reloaded: false, error: ...) while keeping the previous working asset active and the running game alive.
  • Update docs/en/mcp.md and docs/zh/mcp.md, add changelog.d/mcp-assets-hotreload.md, and add .agents/notes/implemented/feature/2026-11-24-mcp-assets-and-hot-reload.md.

Verification

  • gofmt clean
  • go tool nsgo test and go tool nsgo check -target linux,web for ./assets, ./mcp, ./resource, ./tooling/hotreload
  • go tool nsgo test . (full suite)
  • go run ./tools/changelog check

Closes #469

@github-actions github-actions Bot added documentation Improvements or additions to documentation pkg/tooling pkg/assets pkg/resource area/agents enhancement New feature or request size/XL conflict Conflicts with the target branch; resolve before merging labels Nov 24, 2026
… be reloaded

Manager.ReloadAsset and ReloadGroup now read files, parse atlases and run custom loaders on another goroutine, as Group.Load does, and apply the results on the engine goroutine once they finish. The call waits for that work or for its context; when the context ends first nothing is replaced and custom values that were never applied are released.

Sounds, images with no file behind them and files at a density the screen does not show are reported in ReloadedAsset.Skipped instead of being reloaded: a sound decode failure was dropped while the tool reported success, generated textures failed every group reload, and reloading an unshown density replaced a multi-scale source with the wrong file. A group reload also skips an image its reader cannot find. The MCP results carry skipped per item and a skipped count, and reloaded is false when nothing was actually replaced.

game_asset_reload with all: true now refuses a bridge whose only source is Config.ReloadAsset, materials sharing one file are reloaded once, the atlas memory estimate is shared through assets.EstimateAtlasBytes instead of a copy in game/mcp, and the Revision doc covers ReloadAsset and ReloadGroup.
@houko
houko force-pushed the feat/mcp-assets-hotreload-469 branch from a5b6f18 to 8ee2bbc Compare November 24, 2026 19:41
@github-actions github-actions Bot removed the conflict Conflicts with the target branch; resolve before merging label Nov 24, 2026
@houko
houko merged commit 4701b80 into main Nov 24, 2026
21 of 36 checks passed
@houko
houko deleted the feat/mcp-assets-hotreload-469 branch November 24, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agents documentation Improvements or additions to documentation enhancement New feature or request pkg/assets pkg/resource pkg/tooling size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP: assets and hot reload

1 participant