> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Apply Tool Filters • AI Agent SDK

> apply_tool_filters: Public API to (re)apply allow/deny tool filters to this instance.

# apply\_tool\_filters

Method

> This is a method of the [**MCP**](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/MCP.md) class in the [**mcp**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/mcp.md) module.

Public API to (re)apply allow/deny tool filters to this instance.

Lets callers (e.g. the loader) express include/exclude intent without
reaching into private state. `allowed_tools` wins over
`disabled_tools` when both are supplied.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%

graph LR
    agent["Agent"] -- "uses" --> tool["Tool: apply_tool_filters"]
    tool -- "returns" --> result["Result"]
    style tool fill:#189AB4,color:#fff
    style agent fill:#8B0000,color:#fff
    style result fill:#8B0000,color:#fff
```

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def apply_tool_filters(allowed_tools: Optional[List[str]], disabled_tools: Optional[List[str]]) -> 'MCP'
```

## Parameters

**allowed\_tools** `Optional`

Only these tool names are kept (allowlist).

**disabled\_tools** `Optional`

These tool names are removed (denylist).

### Returns

**Returns** `'MCP'`

self, to allow fluent chaining.

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/mcp/mcp.py#L1151)
>
> `praisonaiagents/mcp/mcp.py` at line 1151

***

## Related Documentation

> [card] [Tools Concept](https://praison.ai/docs/docs/concepts/tools)

> [card] [Create Custom Tools](https://praison.ai/docs/docs/guides/tools/create-custom-tools)

> [card] [Tool Development](https://praison.ai/docs/docs/tutorials/advanced-tool-development)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.