pyfsr.cli.appliance.ai¶
appliance.ai – the per-agent MCP tool allow-list of the FortiAI runtime (fsr-ai).
Binding an MCP server to an agent over REST (AIApi.allow_mcp_server_for_agent) is
not enough for the agent to use its tools. At run time each agent’s
ToolExecutionAgent loads only the tools named in the agent package’s own
/opt/fsr-ai/ai-agents/<agent>_<version>/config/memory.yaml:
allowed_tools:
"<mcp-server-uuid>": ["tool_a", "tool_b"] # [] = the server's tools are blocked
A server that is bound over REST but absent from that file is silently never called: the
investigation completes without it and nothing in the trace says why. No API exposes
the file, so it has to be edited on the box. allow_mcp_tools() does that
idempotently (it only ever adds tool names), keeps a one-time .orig backup, and
can restart fsr-ai / fsr-ai-celery so the agents reload it.
The new text is passed as a command argument, never on stdin: the transports put the sudo password on stdin, and with passwordless sudo nothing consumes it, so it would land in the file. Live-verified on 8.0.0 and 8.0.1.
Attributes¶
Classes¶
Outcome of |
Functions¶
|
The |
|
Return |
|
The newest installed package directory of |
|
Path of the agent's |
|
The agent's allow-list: MCP server uuid -> tool names. Read-only. |
|
Allow |
Module Contents¶
- class pyfsr.cli.appliance.ai.AllowChange(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelOutcome of
allow_mcp_tools().
- pyfsr.cli.appliance.ai.parse(text: str) dict[str, list[str]][source]¶
The
allowed_toolsmapping (server uuid -> tool names) of amemory.yamltext.
- pyfsr.cli.appliance.ai.add_tools(text: str, mcp_uuid: str, tools: list[str], *, comment: str = '') str[source]¶
Return
memory.yamltextwithtoolsallowed onmcp_uuid.An existing entry for the server is rewritten in place with the union of its tools (order kept, trailing comment kept); otherwise a new entry is appended to the
allowed_toolsblock. Nothing is ever removed.
- pyfsr.cli.appliance.ai.agent_dir(transport: pyfsr.cli.appliance.transport.Transport, agent: str) str[source]¶
The newest installed package directory of
agent(siem->.../siem_1_0_0).
- pyfsr.cli.appliance.ai.memory_path(transport: pyfsr.cli.appliance.transport.Transport, agent: str) str[source]¶
Path of the agent’s
config/memory.yaml.
- pyfsr.cli.appliance.ai.allowed_tools(transport: pyfsr.cli.appliance.transport.Transport, agent: str) dict[str, list[str]][source]¶
The agent’s allow-list: MCP server uuid -> tool names. Read-only.
- pyfsr.cli.appliance.ai.allow_mcp_tools(transport: pyfsr.cli.appliance.transport.Transport, agent: str, mcp_uuid: str, tools: list[str], *, comment: str = '', restart: bool = False, yes: bool = False) AllowChange[source]¶
Allow
toolsof the MCP servermcp_uuidforagent. Gated byyes.A no-op (nothing written, no
yesneeded) when every tool is already allowed. Otherwise it keeps a one-timememory.yaml.orig, writes the merged file and reads it back so the result reports what is on disk. Withrestart=Trueit restartsfsr-aiandfsr-ai-celeryafterwards (agents only load the file at start).