add_to_blacklist
Block email addresses from receiving future transactional emails to honor opt-out requests and ensure compliance. Permanently prevents delivery until manually removed.
Instructions
Explicitly blacklist an email address, permanently preventing all future emails to this address. This is a write operation — the recipient will not receive any transactional or relay emails until removed via remove_from_blacklist. Use this for opt-out requests or compliance blocks. Returns the created blacklist entry.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Yes | Email address to blacklist |
Implementation Reference
- src/index.ts:259-265 (handler)The handler function for the 'add_to_blacklist' tool. It receives an email parameter, calls client.post('/blacklist', { email }) to add the email to the blacklist via the Inxmail API, and returns the result formatted as JSON.
server.tool("add_to_blacklist", "Explicitly blacklist an email address, permanently preventing all future emails to this address. This is a write operation — the recipient will not receive any transactional or relay emails until removed via remove_from_blacklist. Use this for opt-out requests or compliance blocks. Returns the created blacklist entry.", { email: z.string().describe("Email address to blacklist"), }, async ({ email }) => { try { return json(await client.post("/blacklist", { email })); } catch (e: any) { return error(e.message); } }); - src/index.ts:259-260 (schema)The Zod input schema for the 'add_to_blacklist' tool, defining the 'email' parameter as a required string with a description.
server.tool("add_to_blacklist", "Explicitly blacklist an email address, permanently preventing all future emails to this address. This is a write operation — the recipient will not receive any transactional or relay emails until removed via remove_from_blacklist. Use this for opt-out requests or compliance blocks. Returns the created blacklist entry.", { email: z.string().describe("Email address to blacklist"), - src/index.ts:259-265 (registration)The MCP tool registration where 'add_to_blacklist' is registered with the server using server.tool(). Includes the tool name, description, input schema, and handler function.
server.tool("add_to_blacklist", "Explicitly blacklist an email address, permanently preventing all future emails to this address. This is a write operation — the recipient will not receive any transactional or relay emails until removed via remove_from_blacklist. Use this for opt-out requests or compliance blocks. Returns the created blacklist entry.", { email: z.string().describe("Email address to blacklist"), }, async ({ email }) => { try { return json(await client.post("/blacklist", { email })); } catch (e: any) { return error(e.message); } }); - src/client.ts:90-92 (helper)The InxmailClient.post() method used by the add_to_blacklist handler to make HTTP POST requests to the Inxmail API.
async post<T = unknown>(path: string, body?: unknown, params?: Record<string, string | number | boolean | string[] | undefined>): Promise<T> { return this.request<T>("POST", path, { body, params }); } - src/index.ts:39-45 (helper)Helper functions 'json' and 'error' used by the add_to_blacklist handler to format successful responses and error messages.
function json(data: unknown) { return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } function error(msg: string) { return { content: [{ type: "text" as const, text: msg }], isError: true as const }; }