Skip to main content
Glama

delete_segment

Delete a specified segment from a Mailchimp audience by providing the list ID and segment ID.

Instructions

Delete a segment from an audience.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
list_idYes
segment_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The delete_segment tool handler function. Accepts list_id and segment_id, calls DELETE on the Mailchimp API endpoint /lists/{list_id}/segments/{segment_id}, and returns a confirmation message.
    @mcp.tool()
    async def delete_segment(list_id: str, segment_id: str) -> str:
        """Delete a segment from an audience."""
        mc = get_client()
        await mc.delete(f"/lists/{list_id}/segments/{segment_id}")
        return _fmt({"segment_id": segment_id, "message": "Segment deleted."})
  • The @mcp.tool() decorator registers delete_segment as a tool with the FastMCP server. No schema file exists separately; the handler's signature defines the input schema.
    @mcp.tool()
  • The _fmt helper function used by delete_segment to format the response as indented JSON.
    def _fmt(data: Any) -> str:
        """Format response data as indented JSON string."""
        return json.dumps(data, indent=2, default=str)
  • The get_client helper function used by delete_segment to obtain the Mailchimp API client singleton.
    def get_client() -> MailchimpClient:
        global _client
        if _client is None:
            api_key = os.environ.get("MAILCHIMP_API_KEY", "")
            if not api_key or "-" not in api_key:
                raise ValueError(
                    "MAILCHIMP_API_KEY environment variable required. "
                    "Format: xxxxxxxxxx-usXX "
                    "(get yours at https://mailchimp.com/account/api)"
                )
            _client = MailchimpClient(api_key)
        return _client
  • The MailchimpClient.delete method used by delete_segment to make the HTTP DELETE request to the Mailchimp API.
    async def delete(self, path: str) -> Any:
        return await self._request("DELETE", path)
Behavior2/5

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

No annotations are provided, so the description bears full burden. It only implies destructive behavior ('Delete') but does not disclose reversibility, permission requirements, side effects (e.g., impact on campaigns using the segment), or any return value.

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

Conciseness5/5

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

The description is a single sentence with no unnecessary words. It is front-loaded and efficient.

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

Completeness2/5

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

For a deletion tool with no annotations and no parameter details, the description is incomplete. It does not mention the output schema or confirm successful deletion, leaving the agent without essential behavioral and result information.

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

Parameters2/5

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

Schema coverage is 0% with no parameter descriptions. The description adds minimal context ('from an audience' hints at list_id) but does not explain what list_id and segment_id represent, how to obtain them, or any constraints.

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

Purpose4/5

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

The description clearly states the action (Delete) and the resource (segment from an audience). It is a specific verb+resource pair, but lacks differentiation from other delete tools like delete_campaign or delete_member_permanent, which prevents a score of 5.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives such as 'update_segment' or other delete operations. No prerequisites, context, or exclusions provided.

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/AlexlaGuardia/mcp-mailchimp'

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