Skip to main content
Glama

create_campaign

Create email campaigns for newsletters with customizable content, sender selection, and recipient targeting using Liquid templates.

Instructions

Create a new email campaign. Does NOT send it — use send_campaign after.

The body supports Liquid templates: {{ contact.first_name }}, {{ contact.email }}.

Args: subject: Email subject line. text_body: Email body content (markdown by default). sender_id: Sender ID to send from (e.g. "ms_12345"). Use list_senders to find IDs. settings_type: Content type — "markdown", "text", "mjml", or "block" (default: "markdown"). segment_id: Optional segment ID to restrict recipients (e.g. "sgm_12345"). preview_text: Optional preview text shown in email clients.

Returns: The created campaign record.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subjectYes
text_bodyYes
sender_idYes
settings_typeNomarkdown
segment_idNo
preview_textNo

Implementation Reference

  • mcp_server.py:125-146 (registration)
    The tool 'create_campaign' is registered here using @mcp.tool(). It acts as a wrapper that calls the underlying _client.create_campaign method.
    @mcp.tool()
    def create_campaign(subject: str, text_body: str, sender_id: str,
                        settings_type: str = "markdown", segment_id: str | None = None,
                        preview_text: str | None = None) -> dict:
        """
        Create a new email campaign. Does NOT send it — use send_campaign after.
    
        The body supports Liquid templates: {{ contact.first_name }}, {{ contact.email }}.
    
        Args:
            subject: Email subject line.
            text_body: Email body content (markdown by default).
            sender_id: Sender ID to send from (e.g. "ms_12345"). Use list_senders to find IDs.
            settings_type: Content type — "markdown", "text", "mjml", or "block" (default: "markdown").
            segment_id: Optional segment ID to restrict recipients (e.g. "sgm_12345").
            preview_text: Optional preview text shown in email clients.
    
        Returns:
            The created campaign record.
        """
        return _client.create_campaign(subject=subject, text_body=text_body, sender_id=sender_id,
                                       settings_type=settings_type, segment_id=segment_id, preview_text=preview_text)
  • The actual implementation of create_campaign, which prepares the request data for the API.
    def create_campaign(self, subject: str, text_body: str, sender_id: str,
                        settings_type: str = "markdown", segment_id: str | None = None,
                        preview_text: str | None = None, data: dict | None = None) -> dict:
        """Create a new campaign."""
        campaign_data = {
            "subject": subject,
            "text_body": text_body,
            "sender_id": sender_id,
            "settings": {"type": settings_type},
        }
        if segment_id:
            campaign_data["segment_id"] = segment_id
        if preview_text:
            campaign_data["preview_text"] = preview_text
        if data:
            campaign_data["data"] = data
        resp = self.session.post(f"{self.url}/api/v1/campaigns", json={"data": campaign_data}, headers=self._headers(), timeout=30)
        resp.raise_for_status()
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full disclosure burden. It successfully clarifies the creation vs. sending distinction and documents Liquid template support ({{ contact.first_name }}). Minor gap: lacks details on idempotency, validation errors, or rate limiting that would help an agent handle failures.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with logical flow: purpose statement, behavioral caveat, template syntax note, Args block, and Returns line. Information is front-loaded. The Args/Returns blocks are slightly verbose for MCP context but justified given complete lack of schema descriptions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given zero schema descriptions, no annotations, and no output schema, the description provides comprehensive coverage: explains the campaign object creation, recipient segmentation, templating capabilities, and return value. Could be improved by describing the campaign record structure in Returns, but sufficient for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 0% description coverage (titles only). Description fully compensates by documenting all 6 parameters in the Args block, including critical details like optionality (segment_id, preview_text), format examples ('ms_12345', 'sgm_12345'), enumerated values for settings_type, and the reference to list_senders for sender_id semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States specific action ('Create a new email campaign') with clear resource type. Explicitly distinguishes from sibling tool send_campaign by stating 'Does NOT send it — use send_campaign after', preventing incorrect agent assumptions about immediate sending behavior.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit workflow guidance: 'Does NOT send it — use send_campaign after'. Also directs users to sibling tool list_senders with 'Use list_senders to find IDs', linking the tool to its necessary dependencies and prerequisite operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/gwbischof/keila-mcp'

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