Automating Tool Creation with Bedrock AgentCore Gateway
One of the biggest hurdles in agent development is manually writing “glue code” for every external API. Bedrock AgentCore Gateway eliminates this by providing a “zero-code” path to tool creation. By pointing the Gateway to a standard OpenAPI specification (Swagger), it automatically generates a Model Context Protocol (MCP) server. This allows your Strands Agent to understand and interact with any REST API—complete with complex request schemas and authentication—without you writing a single line of integration logic.
The Gateway also handles enterprise-grade security by managing the handshake between your agent and the external service. You can configure JWT-based authentication for the agent itself and link it to AgentCore Identity to securely inject the external API keys (like Exa or Slack) into the headers of every outgoing request.
A. Generating MCP Tools from an OpenAPI Spec
Instead of writing Python functions, you simply register the API’s OpenAPI URL. The Gateway parses the specification and instantly exposes every endpoint as a callable tool for the agent.
from bedrock_agentcore.tools.gateway_client import GatewayClient
# Initialize the Gateway Client
gateway_client = GatewayClient(region="us-east-1")
# Create a Gateway that converts an OpenAPI spec into MCP tools
gateway = gateway_client.create_gateway(
name="ExaSearchGateway",
auth_config={"type": "JWT"}, # Secure the gateway itself
targets=[{
"name": "ExaAPI",
"openapi_url": "https://api.exa.ai/openapi.json", # The "source of truth"
"credential_provider_id": "your-secure-credential-id" # Injected securely
}]
)
print(f"Gateway generated MCP endpoint: {gateway['endpoint']}")
B. Using Generated Tools in a Strands Agent
The Strands Agent treats the Gateway like any other toolset. Because the Gateway provides full semantic descriptions from the OpenAPI spec, the agent knows exactly which parameters to send to the external API to get the job done.
from strands import Agent
from strands.models import BedrockModel
from strands_tools.gateway import AgentCoreGateway
# Connect the Strands Agent to the Gateway
agentcore_gateway = AgentCoreGateway(region="us-east-1", gateway_id=gateway["id"])
agent = Agent(
model=BedrockModel(model_id="us.amazon.nova-pro-v1:0"),
system_prompt="You are a research assistant. Use the Exa tools to find live data.",
tools=[agentcore_gateway.gateway] # All OpenAPI endpoints are now tools
)
# The agent automatically picks the correct 'search' endpoint from the spec
agent("Search for the top 5 trending research papers in Quantum Computing from this week.")
Key Takeaway: Bedrock AgentCore Gateway is the ultimate bridge between AI and the existing web. It turns standard documentation into functional code, allowing you to scale an agent’s capabilities from a single tool to an entire ecosystem of APIs in minutes. By moving from manual coding to specification-driven integration, you ensure your agents are always aligned with the latest version of the services they consume.

