mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 10:34:35 -07:00
docs(mcp): standardize mcp tool fqn documentation (#21664)
This commit is contained in:
@@ -76,9 +76,13 @@ The `toolName` in the rule must match the name of the tool being called.
|
||||
|
||||
- **Wildcards**: You can use wildcards to match multiple tools.
|
||||
- `*`: Matches **any tool** (built-in or MCP).
|
||||
- `server__*`: Matches any tool from a specific MCP server.
|
||||
- `*__toolName`: Matches a specific tool name across **all** MCP servers.
|
||||
- `*__*`: Matches **any tool from any MCP server**.
|
||||
- `mcp_server_*`: Matches any tool from a specific MCP server.
|
||||
- `mcp_*_toolName`: Matches a specific tool name across **all** MCP servers.
|
||||
- `mcp_*`: Matches **any tool from any MCP server**.
|
||||
|
||||
> **Recommendation:** While FQN wildcards are supported, the recommended
|
||||
> approach for MCP tools is to use the `mcpName` field in your TOML rules. See
|
||||
> [Special syntax for MCP tools](#special-syntax-for-mcp-tools).
|
||||
|
||||
#### Arguments pattern
|
||||
|
||||
@@ -164,8 +168,8 @@ A rule matches a tool call if all of its conditions are met:
|
||||
|
||||
1. **Tool name**: The `toolName` in the rule must match the name of the tool
|
||||
being called.
|
||||
- **Wildcards**: You can use wildcards like `*`, `server__*`, or
|
||||
`*__toolName` to match multiple tools. See [Tool Name](#tool-name) for
|
||||
- **Wildcards**: You can use wildcards like `*`, `mcp_server_*`, or
|
||||
`mcp_*_toolName` to match multiple tools. See [Tool Name](#tool-name) for
|
||||
details.
|
||||
2. **Arguments pattern**: If `argsPattern` is specified, the tool's arguments
|
||||
are converted to a stable JSON string, which is then tested against the
|
||||
@@ -224,7 +228,7 @@ toolName = "run_shell_command"
|
||||
subagent = "generalist"
|
||||
|
||||
# (Optional) The name of an MCP server. Can be combined with toolName
|
||||
# to form a composite name like "mcpName__toolName".
|
||||
# to form a composite FQN internally like "mcp_mcpName_toolName".
|
||||
mcpName = "my-custom-server"
|
||||
|
||||
# (Optional) Metadata hints provided by the tool. A rule matches if all
|
||||
@@ -301,7 +305,16 @@ priority = 100
|
||||
### Special syntax for MCP tools
|
||||
|
||||
You can create rules that target tools from Model Context Protocol (MCP) servers
|
||||
using the `mcpName` field or composite wildcard patterns.
|
||||
using the `mcpName` field. **This is the recommended approach** for defining MCP
|
||||
policies, as it is much more robust than manually writing Fully Qualified Names
|
||||
(FQNs) or string wildcards.
|
||||
|
||||
> **Warning:** Do not use underscores (`_`) in your MCP server names (e.g., use
|
||||
> `my-server` rather than `my_server`). The policy parser splits Fully Qualified
|
||||
> Names (`mcp_server_tool`) on the _first_ underscore following the `mcp_`
|
||||
> prefix. If your server name contains an underscore, the parser will
|
||||
> misinterpret the server identity, which can cause wildcard rules and security
|
||||
> policies to fail silently.
|
||||
|
||||
**1. Targeting a specific tool on a server**
|
||||
|
||||
|
||||
Reference in New Issue
Block a user