Skip to main content
Glama
bcharleson

Instantly MCP Server

list_campaigns

Read-only

Retrieve and manage email outreach campaigns with paginated results, including status, lead counts, and performance metrics. Use search by name and cursor-based navigation to access campaign data efficiently.

Instructions

List campaigns with cursor-based pagination (100 per page).

PAGINATION: If response contains pagination.next_starting_after, there are MORE results. Call again with starting_after= to get next page. Continue until pagination.next_starting_after is null.

Note: search filters by campaign NAME only, not by status. To filter by status, use campaign_status in get_daily_campaign_analytics.

Returns campaign list with status, lead counts, and performance metrics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler function implementing the list_campaigns tool logic. Fetches campaigns from the Instantly.ai API /campaigns endpoint, handles input parameters for pagination (starting_after, limit), search, and tags. Adds helpful pagination hints to the response.
    async def list_campaigns(params: Optional[ListCampaignsInput] = None) -> str:
        """
        List campaigns with cursor-based pagination (100 per page).
        
        PAGINATION: If response contains pagination.next_starting_after, there are 
        MORE results. Call again with starting_after=<that value> to get next page.
        Continue until pagination.next_starting_after is null.
        
        Note: search filters by campaign NAME only, not by status.
        To filter by status, use campaign_status in get_daily_campaign_analytics.
        
        Returns campaign list with status, lead counts, and performance metrics.
        """
        client = get_client()
        
        # Handle case where params is None (for OpenAI/non-Claude clients)
        # Set default limit=100 to return more results by default
        if params is None:
            params = ListCampaignsInput(limit=100)
        
        query_params = {}
        if params.limit:
            query_params["limit"] = params.limit
        else:
            # Default to 100 results if no limit specified
            query_params["limit"] = 100
        if params.starting_after:
            query_params["starting_after"] = params.starting_after
        if params.search:
            query_params["search"] = params.search
        if params.tag_ids:
            query_params["tag_ids"] = params.tag_ids
        
        result = await client.get("/campaigns", params=query_params)
        
        # Add pagination guidance for LLMs
        if isinstance(result, dict):
            pagination = result.get("pagination", {})
            next_cursor = pagination.get("next_starting_after")
            if next_cursor:
                result["_pagination_hint"] = f"MORE RESULTS AVAILABLE. Call list_campaigns with starting_after='{next_cursor}' to get next page."
        
        return json.dumps(result, indent=2)
  • Pydantic BaseModel defining the input schema (parameters) for the list_campaigns tool, including optional fields for limit, pagination cursor (starting_after), search term, and tag filtering.
    class ListCampaignsInput(BaseModel):
        """Input for listing campaigns with pagination."""
        
        # Use extra="ignore" to be tolerant of unexpected fields from LLMs
        model_config = ConfigDict(str_strip_whitespace=True, extra="ignore")
        
        limit: Optional[int] = Field(
            default=100, ge=1, le=100,
            description="Results per page (1-100, default: 100)"
        )
        starting_after: Optional[str] = Field(
            default=None,
            description="Pagination cursor - use value from pagination.next_starting_after to get next page"
        )
        search: Optional[str] = Field(
            default=None,
            description="Search by campaign NAME only (not status)"
        )
        tag_ids: Optional[str] = Field(
            default=None,
            description="Comma-separated tag IDs"
        )
  • MCP tool registration annotation in the TOOL_ANNOTATIONS dictionary, marking list_campaigns as read-only (does not modify data). The tool is dynamically registered via the register_tools() function loop.
    "list_campaigns": {"readOnlyHint": True},
Behavior4/5

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

Annotations provide readOnlyHint=true, but the description adds valuable behavioral context: pagination mechanics (cursor-based, 100 per page, continuation logic), search limitations (filters by name only, not status), and return content (campaign list with status, lead counts, performance metrics). No contradictions with annotations.

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 well-structured and front-loaded with key information (list campaigns, pagination details). Each sentence adds value: pagination mechanics, search constraints, alternative tool, and return data. No wasted words.

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

Completeness5/5

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

Given the tool's complexity (pagination, filtering), annotations (readOnlyHint), and output schema (exists), the description is complete. It covers purpose, usage, behavioral traits, and parameter context adequately without needing to detail return values (handled by output schema).

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 description coverage is 0%, but the description compensates by explaining pagination (starting_after usage), search limitations (by name only), and implies parameters like limit (100 per page) and search. It doesn't cover all parameters (e.g., tag_ids), but adds significant meaning beyond the bare schema.

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?

The description clearly states the verb 'List' and resource 'campaigns', specifies cursor-based pagination with 100 per page, and distinguishes from siblings by noting search filters by name only (not status). It explicitly mentions an alternative tool for status filtering (get_daily_campaign_analytics).

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?

The description provides explicit guidance on when to use this tool (for listing campaigns with pagination) versus alternatives (use get_daily_campaign_analytics to filter by status). It also details the pagination continuation logic, offering clear operational context.

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/bcharleson/instantly-mcp-python'

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