sockdock_save_rule
Create or update Slack automation rules that run agents or programs from posts, validating channel, folder, and executable settings before saving and reporting fixes for any errors.
Instructions
Adds a rule (omit name) or changes one (give its name; fields you omit keep their values). SockDock checks it like its own form: the channel must be one the Slack app is in, the folder must exist, and a program must be an executable file. If there are problems nothing is saved and each problem says how to fix it. A new rule goes to the bottom of its channel and gets a name like rule-4 (returned). To clear a field pass "" or []; null or leaving it out keeps it. Settings the form does not show (other allowed tools, a prompt file) are kept. args are split like a shell command line (quotes group words). The user gets a notification on their Mac.
Anyone who can post in the channel can trigger the rule unless allowed_users lists member IDs (find them with sockdock_find_users; [] opens the rule to everyone again). For channel dm the rule reacts to DMs to the Slack app from anyone in the workspace; a new DM rule without allowed_users is limited to the owner (if nobody is registered, you must say who). mention_only: true makes a channel rule run only for posts that mention the Slack app. Posts and thread replies from people not listed are ignored without a reply. If the rule is open to everyone and lets the agent run commands or edit files, the result has a warning: tell the user. An agent rule can always read files in its folder; set allow_web, allow_edit and allowed_commands only to what the task needs, and avoid combining allow_edit with allowed_commands in channels the user does not fully trust. A program gets the post as JSON on stdin and its stdout is the reply (see the server guide for the JSON).
Examples:
{"channel": "#dev-help", "condition_type": "starts_with", "keyword": "review", "runs": "agent", "folder": "/projects/web-app", "instructions": "Review the files named in the post and reply with short findings.", "allowed_commands": ["npm test"]}
{"channel": "#ask", "condition_type": "all_posts", "runs": "agent", "folder": "/notes"} (every post in #ask starts a run)
{"channel": "#ops", "condition_type": "starts_with", "keyword": "ping", "runs": "program", "program": "/bin/ping.sh"}
{"name": "rule-3", "keyword": "deploy"}
{"name": "rule-3", "allowed_users": ["U0123ABCD"]} (only that person may run rule-3)
{"channel": "dm", "condition_type": "starts_with", "keyword": "todo", "runs": "agent", "folder": "/notes"} (DMs starting with todo; only the owner)
{"channel": "#dev-help", "condition_type": "all_posts", "mention_only": true, "runs": "agent", "folder": "~/projects/web-app"} (posts that mention the Slack app)
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "sockdock_save_rule"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | program: arguments | |
| name | No | the rule to change; omit to add a rule | |
| runs | No | agent (default for a new rule) or program | |
| agent | No | for runs agent: claude_code (default) or codex | |
| model | No | agent: for claude_code opus, sonnet or haiku; for codex a Codex model name; empty for the default | |
| folder | No | working folder (absolute or ~/...); for a program, defaults to the program's folder | |
| channel | No | channel name (#dev-help or dev-help) or ID; must be in sockdock_list_channels. dm for DMs to the Slack app | |
| keyword | No | the keyword, or the regular expression (RE2) for match; not used for all_posts | |
| program | No | program: path to the executable; gets the post as JSON on stdin, its stdout is the reply | |
| allow_web | No | agent: may search and fetch the web | |
| allow_edit | No | agent: may edit files in the folder | |
| timeout_sec | No | time limit in seconds; 0 for the default (600 for agents, 300 for programs) | |
| instructions | No | agent: instructions added to its system prompt | |
| mention_only | No | true to run only for posts that mention the Slack app (@app); not used for dm | |
| allowed_users | No | member IDs (U…, from sockdock_find_users) of the only people who may run the rule; [] lets everyone in the channel run it; omitted on a new rule means everyone | |
| condition_type | No | starts_with (default for a new rule), contains, match or all_posts | |
| allowed_commands | No | claude_code only: command prefixes it may run, e.g. 'npm test'. Not for codex, which always runs commands in its sandbox |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| name | No | ||
| warning | No | saved, but tell the user this | |
| problems | No | what to fix, per field (nothing was saved) | |
| config_problems | No |