McpToolFilter Class

  • java.lang.Object
    • com.azure.ai.agents.models.McpToolFilter

Implements

public final class McpToolFilter
implements JsonSerializable<McpToolFilter>

MCP tool filter A filter object to specify which tools are allowed.

Constructor Summary

Constructor Description
McpToolFilter()

Creates an instance of McpToolFilter class.

Method Summary

Modifier and Type Method and Description
static McpToolFilter fromJson(JsonReader jsonReader)

Reads an instance of McpToolFilter from the JsonReader.

List<String> getToolNames()

Get the toolNames property: MCP allowed tools List of allowed tool names.

Boolean isReadOnly()

Get the readOnly property: Indicates whether or not a tool modifies data or is read-only.

McpToolFilter setReadOnly(Boolean readOnly)

Set the readOnly property: Indicates whether or not a tool modifies data or is read-only.

McpToolFilter setToolNames(List<String> toolNames)

Set the toolNames property: MCP allowed tools List of allowed tool names.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Constructor Details

McpToolFilter

public McpToolFilter()

Creates an instance of McpToolFilter class.

Method Details

fromJson

public static McpToolFilter fromJson(JsonReader jsonReader)

Reads an instance of McpToolFilter from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of McpToolFilter if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If an error occurs while reading the McpToolFilter.

getToolNames

public List<String> getToolNames()

Get the toolNames property: MCP allowed tools List of allowed tool names.

Returns:

the toolNames value.

isReadOnly

public Boolean isReadOnly()

Get the readOnly property: Indicates whether or not a tool modifies data or is read-only. If an MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema\#toolannotations-readonlyhint), it will match this filter.

Returns:

the readOnly value.

setReadOnly

public McpToolFilter setReadOnly(Boolean readOnly)

Set the readOnly property: Indicates whether or not a tool modifies data or is read-only. If an MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema\#toolannotations-readonlyhint), it will match this filter.

Parameters:

readOnly - the readOnly value to set.

Returns:

the McpToolFilter object itself.

setToolNames

public McpToolFilter setToolNames(List<String> toolNames)

Set the toolNames property: MCP allowed tools List of allowed tool names.

Parameters:

toolNames - the toolNames value to set.

Returns:

the McpToolFilter object itself.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to