Skip to main content
Glama

update-smtp-config

Modify SMTP server settings for email sending in the SMTP MCP Server. Change host, port, security, credentials, or default status of existing configurations.

Instructions

Update an existing SMTP configuration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesID of the SMTP configuration to update
nameNoName of the SMTP configuration
hostNoSMTP host
portNoSMTP port
secureNoWhether to use secure connection (SSL/TLS)
userNoSMTP username
passNoSMTP password
isDefaultNoWhether this configuration should be the default

Implementation Reference

  • The main handler function that executes the update-smtp-config tool logic: finds the SMTP config by ID, applies provided updates to its properties, manages default status across configs, and persists the changes using saveSmtpConfigs.
    * Handle update-smtp-config tool call */ async function handleUpdateSmtpConfig(parameters: any) { try { // Get existing configs const configs = await getSmtpConfigs(); // Find the config to update const configIndex = configs.findIndex(config => config.id === parameters.id); if (configIndex === -1) { return { success: false, message: `SMTP configuration with ID ${parameters.id} not found` }; } // Update the config const updatedConfig = { ...configs[configIndex] }; if (parameters.name !== undefined) updatedConfig.name = parameters.name; if (parameters.host !== undefined) updatedConfig.host = parameters.host; if (parameters.port !== undefined) updatedConfig.port = parameters.port; if (parameters.secure !== undefined) updatedConfig.secure = parameters.secure; if (parameters.user !== undefined) updatedConfig.auth.user = parameters.user; if (parameters.pass !== undefined) updatedConfig.auth.pass = parameters.pass; // Handle default flag if (parameters.isDefault !== undefined) { updatedConfig.isDefault = parameters.isDefault; // If setting as default, update other configs if (updatedConfig.isDefault) { configs.forEach((config, index) => { if (index !== configIndex) { config.isDefault = false; } }); } } // Update the config in the list configs[configIndex] = updatedConfig; // Save the updated configs await saveSmtpConfigs(configs); return { success: true, config: updatedConfig }; } catch (error) { logToFile('Error in handleUpdateSmtpConfig:'); logToFile(error instanceof Error ? error.message : 'Unknown error'); return { success: false, message: error instanceof Error ? error.message : 'Unknown error' }; } }
  • The Tool definition object including inputSchema for validating parameters of the update-smtp-config tool (requires 'id', optional fields for name, host, port, secure, user, pass, isDefault).
    "update-smtp-config": { name: "update-smtp-config", description: "Update an existing SMTP configuration", inputSchema: { type: "object", properties: { id: { type: "string", description: "ID of the SMTP configuration to update" }, name: { type: "string", description: "Name of the SMTP configuration" }, host: { type: "string", description: "SMTP host" }, port: { type: "number", description: "SMTP port" }, secure: { type: "boolean", description: "Whether to use secure connection (SSL/TLS)" }, user: { type: "string", description: "SMTP username" }, pass: { type: "string", description: "SMTP password" }, isDefault: { type: "boolean", description: "Whether this configuration should be the default" } }, required: ["id"] } },
  • The switch case in the call_tool request handler that registers and dispatches to the specific handlerUpdateSmtpConfig for the update-smtp-config tool.
    case "update-smtp-config": return await handleUpdateSmtpConfig(toolParams);
  • src/index.ts:59-59 (registration)
    Where the tools record (including update-smtp-config) is created via createToolDefinitions() and passed to setupRequestHandlers for MCP server registration.
    const TOOLS = createToolDefinitions();

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/samihalawa/mcp-server-smtp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server