diff --git a/extensions/mattermost/src/channel.ts b/extensions/mattermost/src/channel.ts index 887a878c5e8..5bec217aa3b 100644 --- a/extensions/mattermost/src/channel.ts +++ b/extensions/mattermost/src/channel.ts @@ -4,6 +4,7 @@ import { buildAccountScopedDmSecurityPolicy, collectAllowlistProviderRestrictSendersWarnings, } from "openclaw/plugin-sdk/channel-policy"; +import { createMessageToolButtonsSchema } from "openclaw/plugin-sdk/channel-runtime"; import { buildComputedAccountStatusSnapshot, buildChannelConfigSchema, @@ -77,6 +78,18 @@ const mattermostMessageActions: ChannelMessageActionAdapter = { .filter((a) => a.enabled && a.botToken?.trim() && a.baseUrl?.trim()); return accounts.length > 0 ? (["buttons"] as const) : []; }, + getToolSchema: ({ cfg }) => { + const accounts = listMattermostAccountIds(cfg) + .map((id) => resolveMattermostAccount({ cfg, accountId: id })) + .filter((a) => a.enabled && a.botToken?.trim() && a.baseUrl?.trim()); + return accounts.length > 0 + ? { + properties: { + buttons: createMessageToolButtonsSchema(), + }, + } + : null; + }, handleAction: async ({ action, params, cfg, accountId }) => { if (action === "react") { // Check reactions gate: per-account config takes precedence over base config