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

</div>

This is a method of the MCP class in the mcp 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.

Diagram

uses

returns

Agent

Tool: apply_tool_filters

Result

Signature

python
def apply_tool_filters(allowed_tools: Optional[List[str]], disabled_tools: Optional[List[str]]) -> 'MCP'

Parameters

ParamField Optional

Only these tool names are kept (allowlist).

ParamField Optional

These tool names are removed (denylist).

Returns

ResponseField 'MCP'

self, to allow fluent chaining.

Source

View on GitHub

praisonaiagents/mcp/mcp.py at line 1151


Related Documentation