An AI agent can ask to create a cloud resource before scanning the infrastructure code that defines it. The AWS Cloud Control API (CCAPI) MCP server does not need to persuade the model to choose a different tool. Instead, it requires a token from the scan step. Without a valid token, the server rejects the creation request.
That check addresses a gap between the Model Context Protocol (MCP) and infrastructure-as-code workflows. MCP lets a client discover and call individual tools, but the protocol does not itself require one call to precede another. An infrastructure pipeline, by contrast, may need to stop when a required check fails.
How the agent learns the order
During initialization, the MCP client and server negotiate the protocol version and their capabilities. The agent learns what inputs each tool needs from its schema and parameter descriptions. In the CCAPI server, a required parameter can identify the earlier tool that supplies its value. For example, the workflow can direct the agent from get_aws_session_info() to generate_infrastructure_code(), then to run_checkov() for a scan before calling create_resource().
The schema tells the agent what to do; server-side validation enforces the dependency. The server generates cryptographically secure, short-lived tokens and keeps them with their associated data in an in-memory store called _workflow_store. The agent carries tokens between calls in its conversation context. If it submits a token that is unknown or has already been consumed, the call fails.
For example, explain() checks a properties_token against the store, consumes it, and returns a new explained_properties_token. The workflow illustration uses different labels for this step: it shows generated_code_token as the input and explained_token as the output. Those labels do not match the implementation described here.

What happens when a session ends
Each agent interaction has its own workflow. If the agent session ends or refreshes, an unfinished workflow must start again. Stopping or restarting the server also clears outstanding tokens because the store lives in memory. The implementation author identifies database storage as an option for deployments that need to preserve state across restarts, rather than a feature of the default design.
The token checks work within FastMCP without a built-in dependency declaration. A FastMCP proposal discusses expressing a prerequisite directly, for example with @mcp.tool(depends_on=["run_checkov"]). That syntax is a proposed alternative, not the mechanism the CCAPI server uses.
