> For the complete documentation index, see [llms.txt](https://docs.p0.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.p0.dev/agentic-access/agentic-gateway/content-filter.md). Agents can also search and read this documentation through its [MCP server](https://docs.p0.dev/~gitbook/mcp).

# Content filter

Scan the MCP tool calls and A2A messages that pass through your gateway with Google Cloud Model Armor or Amazon Bedrock Guardrails, and block or redact what they flag.

The **Content filter** component sends the text of MCP tool calls and A2A messages to a scanning service before the gateway passes them on. When the service flags the text, the gateway blocks the call, or replaces sensitive data with the redacted text the service returns.

{% hint style="info" %}
Content filters are in preview. They may have limited features or support.
{% endhint %}

## Types of content filter

| Provider                                                                                                             | Maturity | What it scans for                                                                                                              |
| -------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ |
| [Google Cloud Model Armor](https://docs.p0.dev/agentic-access/agentic-gateway/content-filter/model-armor.md)         | Preview  | Whatever your Model Armor template turns on, such as prompt injection, sensitive data, malicious URLs, and harmful content.    |
| [Amazon Bedrock Guardrails](https://docs.p0.dev/agentic-access/agentic-gateway/content-filter/bedrock-guardrails.md) | Preview  | Whatever your guardrail's policies turn on, such as denied topics, harmful content, sensitive information, and prompt attacks. |

You decide what counts as a match in the provider's own console. P0 doesn't change your template or guardrail.

## Prerequisites

* A [Gateway](https://docs.p0.dev/agentic-access/agentic-gateway/gateway.md) running version 1.5.0 or later. P0 warns you when you pick an older gateway, and an older gateway ignores the filter.
* The federation component for your provider, installed in the cloud account that holds the template or guardrail: [GCP Workload Identity Federation](https://docs.p0.dev/agentic-access/credential-sources/gcp-wif.md) for Model Armor, or [AWS OIDC](https://docs.p0.dev/agentic-access/credential-sources/aws-oidc.md) for Bedrock Guardrails. The gateway calls the provider as itself through this component, not as the agent whose call it scans.

## Add a content filter

1. Navigate to **Integrations** on [p0.app](https://p0.app) and select **Agentic gateway**, then choose the **Content filter** component.
2. Click **Add content filter**.
3. Enter a **Content filter identifier**, a name for this filter within P0. Use up to 128 letters, digits, `.`, `_`, or `-`, starting with a letter or digit.
4. Set the **Gateway** that applies this filter.
5. Set **Directions**:
   * **Requests and responses**: scan both what the agent sends and what comes back.
   * **Requests only**: scan tool call arguments and messages the agent sends.
   * **Responses only**: scan tool results and messages the agent receives.
6. Set the **Provider**, then finish the provider-specific setup on its page: [Google Cloud Model Armor](https://docs.p0.dev/agentic-access/agentic-gateway/content-filter/model-armor.md) or [Amazon Bedrock Guardrails](https://docs.p0.dev/agentic-access/agentic-gateway/content-filter/bedrock-guardrails.md).

A filter applies to every MCP server and A2A bridge on its gateway as soon as you install it, unless you turn filters off for that server or bridge.

## Choose which traffic is filtered

Each [MCP server](https://docs.p0.dev/agentic-access/agentic-gateway/mcp-server.md) and [A2A bridge](https://docs.p0.dev/agentic-access/agentic-gateway/a2a-bridge.md) has a **Content filters** setting:

* **All**: every content filter on the gateway scans this server's or bridge's traffic. This is the default.
* **None**: no content filter scans it.

To filter only some servers, install the filter, then set **Content filters** to **None** on each server or bridge you want to leave unfiltered. When a gateway has more than one filter, every filter scans the same traffic. If any filter blocks a call, the gateway blocks it.

## What the agent sees

When a filter blocks a call, the agent gets the message `Blocked by content policy` in place of the tool result or agent reply:

* For an MCP tool call, the tool returns an error result with that text.
* For an A2A call over JSON-RPC, the bridge returns a JSON-RPC error with code `-32050`.
* For an A2A call over HTTP+JSON, the bridge returns HTTP `403` with status `PERMISSION_DENIED`.
* If the block happens partway through a streamed A2A reply, the stream ends with the task in a failed state.

When a filter redacts sensitive data, the agent or tool gets the redacted text and the call goes through.

The gateway also blocks a call, rather than letting it through unscanned, when:

* The provider returns an error, or doesn't answer within 3 seconds.
* The call holds content other than text, such as an image, audio, or a file.
* An A2A call sets up push notifications. Push notifications go from the agent straight to the caller, so no filter could scan them.

## Troubleshooting

### Every call is blocked

The gateway blocks calls it can't scan. Follow the troubleshooting steps for Model Armor ([Google Cloud Model Armor](https://docs.p0.dev/agentic-access/agentic-gateway/content-filter/model-armor.md#troubleshooting)) or Bedrock Guardrails ([Amazon Bedrock Guardrails](https://docs.p0.dev/agentic-access/agentic-gateway/content-filter/bedrock-guardrails.md#troubleshooting)). The most common cause is a missing permission for the gateway's identity.

### Calls aren't scanned

* Check that the gateway runs version 1.5.0 or later. See [Upgrade the gateway](https://docs.p0.dev/agentic-access/agentic-gateway/gateway/deploy/upgrade-the-gateway.md).
* Check that the server or bridge has **Content filters** set to **All**.
* Check that the filter's **Directions** include the side of the call you expect to be scanned.
