Smith::Tools::Rule
Inherits Struct < Value < Object
One tool(pattern) entry. What pattern means depends on the tool: for
bash it matches the command, for the file tools the path.
Constants
read_file on its own would silently widen to read_file(*), which is
not what anyone writing a path rule means. Two forms are unambiguous
enough to accept bare: anything carrying a wildcard, and any MCP tool โ
smith cannot interpret a server's arguments, so its name is the only
thing a rule could ever match on.
Tools whose pattern is a path glob rather than a shell command.
Constructors
Class methods
Everything is escaped except *, which becomes .*. The trailing group
is what makes bash(git status) cover git status --short while still
rejecting git statuses.
A pattern starting with ** stays unanchored, so read_file(**/.ssh/**)
can catch a key outside the project. Anything else relative is resolved
against the project directory.
A malformed entry yields nil rather than raising: a typo in a config file must not stop smith from starting.
Instance methods
mcp__filesystem__* covers every tool of that server. Anchored at both
ends, so mcp__fs__read cannot be matched by a rule meant for another
server whose name merely starts the same way.
all distinguishes the two halves of shell-command matching, and the
distinction is security-critical:
allow โ every segment must match, so an allowed prefix cannot smuggle a second command in behind it deny โ any segment matching is enough, so a denied command cannot hide behind a harmless one