SuperAPI AI Directory

wecom-preflight

General & other

View repository

Updated 10-16 08:43

About this skill

WeCom prerequisite check

This skill ensures that the wecom_mcp tool has been correctly granted execution permission.All skills that use wecom_mcp must run this check process before their first call.

Trigger conditions

When the followingany conditionis met, perform the prerequisite check:

  1. In the current sessionfor the first timeit is necessary to call the wecom_mcp tool
  2. When calling wecom_mcp , receive tool not allowed、not permitted、permission denied or a similar permission error

If the current session has already successfully called wecom_mcp(any operation), there is no need to check again.


Check process

Important: All of the following steps are shell commands(executed in the terminal),not MCP tool calls. wecom_mcp is invisible to the AI Agent before it is added to the allowlist, so it cannot be probed with a tool call.

Step 1: Check tools.profile

Execute the following command in the terminal to read the current tools.profile configuration:

openclaw config get tools.profile

Branch based on the returned result:

  • Returns full → ✅ Check passed。full mode has no tool restrictions, all tools (including wecom_mcp) are directly available, no need to check alsoAllow, continue executing the user's original request
  • Returns another value(such as coding、messaging、minimal、undefined or empty) → go to Step 1b (check alsoAllow)
  • Command execution failed(such as command not found: openclaw, permission error, etc.) → go to Step 3 (environment anomaly)

Step 1b: Check tools.alsoAllow

Execute the following command in the terminal to read the current tools.alsoAllow configuration:

openclaw config get tools.alsoAllow

Branch based on the returned result:

  • Returned content contains wecom_mcp(such as ["wecom_mcp"] or ["wecom_mcp", "other_tool"]) → ✅ Allowlist is configured, check passed, continue executing the user's original request
  • Returned content does not contain wecom_mcp(such as an empty array []、undefined, or the list does not contain wecom_mcp) → go to Step 2 (automatic fix)
  • Command execution failed → go to Step 3 (environment anomaly)

Step 2: Automatically fix tools.alsoAllow

Execute the following command in the terminal to add wecom_mcp to the tool allowlist:

openclaw config set tools.alsoAllow '["wecom_mcp"]'

Note: If the list returned by Step 1b already contains other tools (such as ["other_tool"]), they need to be merged before writing, for example:

openclaw config set tools.alsoAllow '["other_tool", "wecom_mcp"]'

Branch based on the execution result:

2a. Command executed successfully

Reply to the user (do not automatically perform a restart):

✅ 已自动将 wecom_mcp 加入工具执行权限白名单(tools.alsoAllow)。
⚠️ 配置变更需要重启 Gateway 后才能生效,请在终端执行以下命令:

openclaw gateway restart

重启完成后请重新发送您的请求。

Why not automatically restart:openclaw gateway restart will interrupt all currently active connections (including this session), if executed automatically by the AI, the user may not see the complete prompt information. Having the user restart manually is more controllable.

2b. Command execution failed

Reply to the user with the following manual repair guide:

❌ 自动配置失败,请在终端手动执行以下命令:

openclaw config set tools.alsoAllow '["wecom_mcp"]'
openclaw gateway restart

完成后请重新发送您的请求。

Step 3: Environment exception handling

If the openclaw command itself fails to execute in step 1 or 1b (e.g. command not found, insufficient permissions, etc.), it indicates that the OpenClaw CLI is not correctly installed or not in PATH; directly tell the user:

⚠️ OpenClaw CLI 不可用:<错误信息>

可能原因:
- OpenClaw 未安装或未加入系统 PATH
- OpenClaw 版本过低,不支持 config 子命令
- 当前 shell 环境缺少必要配置

请检查 OpenClaw 安装状态后重试。
参考:https://docs.openclaw.dev/installation

Notes

  1. Use shell commands throughout: All probing and repair operations of this skill are executed in the terminal via the openclaw CLI,without involving any MCP tool calls. This avoids the deadlock problem of "tool not whitelisted → tool not visible → unable to probe"
  2. profile priority determination:tools.profile is full , all tools are unrestricted, no need to check alsoAllow, and can be quickly skipped
  3. Idempotency: If tools.alsoAllow already contains wecom_mcp,openclaw config set the command will not produce side effects
  4. Preserve existing configuration: When modifying tools.alsoAllow , you need to preserve the other existing tool names in the list and only append wecom_mcp
  5. Do not restart automatically: After automatic configuration succeeds, only prompt the user to restart and provide the command, to be executed manually by the user, avoiding information loss caused by session interruption
  6. Session cache: In the same session, once the check passes (profile is full or alsoAllow contains wecom_mcp), subsequent calls do not need to repeat the check

Quick reference

Scenario Handling method
Before the first call to wecom_mcp Execute the openclaw config get tools.profile check
tools.profile is full ✅ Skip and directly execute the original request
profile is not full + alsoAllow already contains wecom_mcp ✅ Skip and continue execution
profile is not full + alsoAllow does not contain → automatic write succeeds Prompt that it has been configured + attach the openclaw gateway restart command to let the user restart
profile is not full + alsoAllow does not contain → automatic write fails Provide manual repair guide
openclaw CLI unavailable Tell the user to check the OpenClaw installation
wecom_mcp has already been successfully called in the session Skip the check