Skip to main content
Glama
samihalawa

SMTP MCP Server

delete-smtp-config

Remove an SMTP email configuration from the SMTP MCP Server to manage your email sending settings.

Instructions

Delete an SMTP configuration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesID of the SMTP configuration to delete

Implementation Reference

  • The main handler function that executes the delete-smtp-config tool. It finds and removes the SMTP config by ID from storage, prevents deletion of the last config, handles default config promotion, and saves changes.
    async function handleDeleteSmtpConfig(parameters: any) {
      try {
        // Get existing configs
        const configs = await getSmtpConfigs();
        
        // Find the config to delete
        const configIndex = configs.findIndex(config => config.id === parameters.id);
        
        if (configIndex === -1) {
          return {
            success: false,
            message: `SMTP configuration with ID ${parameters.id} not found`
          };
        }
        
        // Check if trying to delete the only config
        if (configs.length === 1) {
          return {
            success: false,
            message: 'Cannot delete the only SMTP configuration'
          };
        }
        
        // Check if deleting the default config
        const isDefault = configs[configIndex].isDefault;
        
        // Remove the config from the list
        configs.splice(configIndex, 1);
        
        // If deleting the default config, set another one as default
        if (isDefault && configs.length > 0) {
          configs[0].isDefault = true;
        }
        
        // Save the updated configs
        await saveSmtpConfigs(configs);
        
        return {
          success: true,
          message: 'SMTP configuration deleted successfully'
        };
      } catch (error) {
        logToFile('Error in handleDeleteSmtpConfig:');
        logToFile(error instanceof Error ? error.message : 'Unknown error');
        return {
          success: false,
          message: error instanceof Error ? error.message : 'Unknown error'
        };
      }
  • Defines the input schema, name, and description for the delete-smtp-config tool.
    "delete-smtp-config": {
      name: "delete-smtp-config",
      description: "Delete an SMTP configuration",
      inputSchema: {
        type: "object",
        properties: {
          id: {
            type: "string",
            description: "ID of the SMTP configuration to delete"
          }
        },
        required: ["id"]
      }
    },
  • Registers the handler for delete-smtp-config in the tool call switch statement.
    case "delete-smtp-config":
      return await handleDeleteSmtpConfig(toolParams);
  • src/index.ts:59-63 (registration)
    Creates the tools map (including delete-smtp-config) and sets up the MCP server request handlers that expose the tools.
    const TOOLS = createToolDefinitions();
    
    // Setup request handlers
    await setupRequestHandlers(server, TOOLS);

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