Repository navigation
feat(mcp): add tunables and debug console tools (#466) - #707
Merged
Merged
Conversation
RegisterString adds a persisted value kind, so the format section names it, its example carries a string tunable, and readTunables registers it so the example stays checked.
Console.SetTunable now takes a clamp flag and returns a TunableChange with the previous value and a snapshot taken under the same lock as the write, so game_tunable_set never clamps with bounds read before a tunable was re-registered. With clamp, an integer beyond int's range (such as 1e30) is clamped to the tunable's bound instead of failing with "overflows int". In release builds SetTunable returns an error rather than a nil error for a write that never happened. mcp.TunableInfo is renamed TunableResult so it no longer shares a name with debug.TunableInfo. The acceptance test now attaches a game.Loop whose Update integrates the jump from the tunable pointers, starts the jump with game_console_exec and steps it with game_loop_step. New tests cover string tunables in SaveTunables/LoadTunables, a number refused for a string tunable with no other value applied, and clamping at int's limits.
houko
force-pushed
the
feat/mcp-tunables-console-466
branch
from
November 24, 2026 19:02
a952974 to
94cdd36
Compare
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
packages/game/mcp/console.gowired throughConfig.Console,Config.ConsoleFuncandBridge.SetConsoleinpackages/game/mcp/mcp.go:game_tunables_list— deterministically lists registereddebug.Consoletunables (with optionalprefixfilter), type, current value, registration default, and numeric bounds.game_tunable_get— reads one registered tunable's current value and metadata by name.game_tunable_set— strictly type-checks and updates a registered tunable (float,int,boolorstring), validates numeric ranges by default (or clamps whenclamp: true), and returns bothold_valueand appliedvalue.game_console_commands_list— lists built-in and customdebug.Consolecommands with help text (with optionalinclude_builtin).game_console_exec— runs a console command string throughdebug.Console.Execand returns{command, ok, output, lines, error}.RegisterString,Tunables,Tunable,SetTunable,Commands) plusTunableInfoandCommandInfotopackages/game/debugwith matching release-build stubs.nsgotest+automation.Calltests (packages/game/mcp/console_test.go) verifying live tunable mutation affects simulation behavior, console command listing/execution, dynamicConsoleFunc/SetConsole, and strict error handling.docs/en/mcp.mdanddocs/zh/mcp.md, addchangelog.d/mcp-tunables-console-466.md, and add.agents/notes/implemented/feature/2026-11-24-mcp-tunables-and-console.md.Verification
git ls-files -z -- '*.go' | xargs -0 -r gofmt -l(empty)(cd packages/game && env -u GOROOT go run ./cmd/gameschema -check)(cd packages/game && env -u GOROOT go tool nsgo check -target macos,windows,linux,android,web)(cd packages/game && env -u GOROOT go tool nsgo test ./mcp && env -u GOROOT go tool nsgo test ./debug && env -u GOROOT go tool nsgo test -run TestStabilityTable .)(cd packages/game && env -u GOROOT go build -tags release ./debug ./mcp)env -u GOROOT go run ./tools/changelog checkbun run verify-notesCloses #466