Mattermost: own message tool button schema

This commit is contained in:
Gustavo Madeira Santana
2026-03-17 23:48:11 +00:00
parent dbc367e50a
commit d95dc50e0a

View File

@@ -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