Dynamic AI agent guidance with a stateful MCP server

3 jesse_portal 1 6/2/2025, 4:23:22 PM portal.one ↗
Hi HN,

Jesse from Portal One here. We all know AI agents get lost or struggle with complex, multi-step tasks.

Our article explores a way to make agents more reliable using dynamic Model Context Protocol (MCP) servers. Instead of just being a static API wrapper, the MCP server actively guides the agent by changing the available tools and information based on the current task state, an adaptive environment.

To illustrate this "guided tour" concept, we built a very simple demo server where an agent plays a Number Guessing Game.

The game itself is trivial, but the mechanics demonstrate the core idea:

- Lobby state: Agent sees only `start_game` tool.

- Game started: `start_game` is removed; `guess_number` and `give_up` tools appear.

- Guess made: The `guess_number` tool's own input schema adapts (e.g., guess must now be > 50).

- Game ends: Tools revert to the lobby state.

The full article details this flow and how the server uses MCP notifications (`toolListChanged`, etc.) to keep the agent updated.

The real importance isn't the game, but what this dynamic guidance concept unlocks for helping agents stay on task.

GitHub Repo & Demos:

https://github.com/portal-labs-infrastructure/number-guessing-game-mcp-server

Comments (1)

jesse_portal · 3d ago
Hi HN,

Jesse from Portal One here. We all know AI agents get lost or struggle with complex, multi-step tasks.

Our article explores a way to make agents more reliable using dynamic Model Context Protocol (MCP) servers. Instead of just being a static API wrapper, the MCP server actively guides the agent by changing the available tools and information based on the current task state, an adaptive environment.

To illustrate this "guided tour" concept, we built a very simple demo server where an agent plays a Number Guessing Game.

The game itself is trivial, but the mechanics demonstrate the core idea:

- Lobby state: Agent sees only `start_game` tool.

- Game started: `start_game` is removed; `guess_number` and `give_up` tools appear.

- Guess made: The `guess_number` tool's own input schema adapts (e.g., guess must now be > 50).

- Game ends: Tools revert to the lobby state.

The full article details this flow and how the server uses MCP notifications (`toolListChanged`, etc.) to keep the agent updated.

The real importance isn't the game, but what this dynamic guidance concept unlocks for helping agents stay on task.

GitHub Repo & Demos:

https://github.com/portal-labs-infrastructure/number-guessin...