Use an AgentCore Gateway with Policy in AgentCore
Follow the gateway authorization and authentication guide to obtain the credentials needed for gateway access.
MCP tools only
Policy evaluation applies only to MCP tools. Regardless of the policy evaluation mode, the gateway always allows MCP prompts (prompts/list, prompts/get) and resources (resources/list, resources/read, resources/templates/list).
Topics
List AgentCore Gateway Tools with Policy in AgentCore
Tool listing is treated as a meta action . When a principal lists available tools, the policy engine does not evaluate the full context of a specific tool invocation (for example, input parameters).
A principal is only allowed to see tools in the listing that they would be permitted to call by policy. Because the full context of a tool call is not available during listing, this means a principal is allowed to list a tool if there exists any set of circumstances under which a call to that tool would be permitted.
As a result, a tool appearing in the list does not guarantee that a subsequent call to that tool will be authorized. The authorization decision for an actual tool invocation is evaluated separately using the full request context, including input parameters.
Select one of the following methods:
Example
Call gateway tools with policy
Make tool calls to your gateway. Policy evaluation determines whether the call is allowed or denied.
Select one of the following methods:
Example
Passing the policy session ID for temporal policies
To enable temporal policy evaluation, include the x-amzn-bedrock-agentcore-policy-session-id header
in your requests. This groups multiple invocations into a single session for session-aware policy
enforcement.
curl -X POST \ https://mygateway-abcdefghij.gateway.bedrock-agentcore.us-west-2.amazonaws.com/mcp \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "x-amzn-bedrock-agentcore-policy-session-id: YOUR_SESSION_ID" \ -d '{ "jsonrpc": "2.0", "id": "test-temporal-policy", "method": "tools/call", "params": { "name": "tool_name", "arguments": {arguments} } }'
The Gateway does not generate a session ID on your behalf. You must generate the session ID and send it on every request, starting with your first request. If you omit the header, or send an empty value, the Gateway does not establish a session. If the associated policy engine contains a temporal policy, requests without a session ID fail with a validation error. Send the same ID with every request in the same session.
Policy responses
When a policy allows the request:
{ "jsonrpc": "2.0", "id": 2, "result": { "isError": false, "content": [ { "type": "text", "text": "ToolResult" } ] } }
When a policy denies the request:
{ "jsonrpc": "2.0", "id": 2, "result": { "content": [ { "type": "text", "text": "AuthorizeActionException - Tool Execution Denied: Tool call not allowed due to policy enforcement [No policy applies to the request (denied by default).]" } ], "isError": true } }