From f24d0cfe8aebcc3d1e33d80f63d5b57b88bf1c5d Mon Sep 17 00:00:00 2001 From: Haakam Aujla Date: Tue, 27 Jan 2026 23:34:03 -0800 Subject: [PATCH] Resolve review --- extensions/agentmail/src/tools.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/extensions/agentmail/src/tools.ts b/extensions/agentmail/src/tools.ts index ca4252c52..15b9f99d6 100644 --- a/extensions/agentmail/src/tools.ts +++ b/extensions/agentmail/src/tools.ts @@ -1,13 +1,18 @@ import type { ChannelAgentTool } from "clawdbot/plugin-sdk"; import { AgentMailToolkit } from "agentmail-toolkit/clawdbot"; -import { getAgentMailClient } from "./client.js"; +import { getResolvedCredentials } from "./client.js"; +import { AgentMailClient } from "agentmail"; /** * Returns all AgentMail agent tools. + * Returns empty array if AgentMail is not configured (no token). */ export function createAgentMailTools(): ChannelAgentTool[] { - const client = getAgentMailClient(); + const { apiKey } = getResolvedCredentials(); + if (!apiKey) return []; + + const client = new AgentMailClient({ apiKey }); const toolkit = new AgentMailToolkit(client); return toolkit.getTools(); }