Skip to main content
Glama
jun7680

Kakao Moment MCP

by jun7680

list_campaigns

Retrieve a list of campaigns with details such as status, daily budget, and type. Filter by campaign status like ON or OFF easily.

Instructions

전체 캠페인 목록(이름·상태·일예산·캠페인 타입) 조회.

이런 질문에 사용하세요: • "캠페인 목록 보여줘" / "어떤 캠페인 돌고 있어?" • "지금 켜져 있는 캠페인만 알려줘" → status_filter="ON" • "꺼져 있는 캠페인" / "OFF 상태 캠페인" → status_filter="OFF" • "캠페인 ID 뭐였지?" / "캠페인 일예산 얼마야?"

Args: status_filter: ON / OFF / DELETED 등의 상태 필터 (선택) with_details: True(기본) 면 캠페인별 detail 을 함께 조회해 일예산/타입을 채움. 캠페인이 많아 느릴 때 False 로 끄세요.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
status_filterNo
with_detailsNo

Implementation Reference

  • Core handler: async function list_campaigns() that calls Kakao API /openapi/v4/campaigns, optionally fetches details per campaign (daily_budget, type, goal), and returns a normalized dict with count, items, summary, and raw data.
    async def list_campaigns(
        client: KakaoMomentClient,
        status_filter: str | None = None,
        *,
        with_details: bool = True,
    ) -> dict[str, Any]:
        """캠페인 목록.
    
        Args:
            status_filter: ON / OFF / DELETED 등 카카오 상태 코드. None 이면 전체.
            with_details: True 면 캠페인별 detail 을 동시 호출해 일예산/타입/생성일 보강.
                          카카오 list 엔드포인트는 id/name/config 만 반환하므로 기본 ON.
                          대규모 계정(수백개)에서 부담되면 False 로 끌 수 있음.
        """
        params: dict[str, Any] = {}
        if status_filter:
            params["config"] = status_filter.upper()
        data = await client.get("/openapi/v4/campaigns", params=params or None)
        rows = extract_rows(data)
    
        details: dict[Any, dict[str, Any]] = {}
        if with_details and rows:
            details = await fetch_details(
                client,
                "/openapi/v4/campaigns/{id}",
                [r.get("id") for r in rows],
            )
    
        items: list[dict[str, Any]] = []
        for r in rows:
            merged = {**r, **details.get(r.get("id"), {})}
            type_goal = merged.get("campaignTypeGoal")
            items.append(
                {
                    "id": merged.get("id"),
                    "name": merged.get("name"),
                    "campaign_type": (
                        type_goal.get("campaignType")
                        if isinstance(type_goal, dict)
                        else merged.get("campaignType")
                    ),
                    "goal": (
                        type_goal.get("goal") if isinstance(type_goal, dict) else None
                    ),
                    "status": merged.get("config") or merged.get("status"),
                    "daily_budget": merged.get("dailyBudgetAmount")
                    or merged.get("dailyBudget"),
                    "is_over_budget": merged.get("isDailyBudgetAmountOver"),
                    "status_description": merged.get("statusDescription"),
                    "created_at": merged.get("createdDate"),
                }
            )
    
        on_count = sum(1 for it in items if str(it.get("status", "")).upper() == "ON")
        off_count = sum(
            1 for it in items if str(it.get("status", "")).upper() in ("OFF", "PAUSED")
        )
        total_budget = sum(
            float(it.get("daily_budget") or 0) for it in items if it.get("daily_budget")
        )
        summary = (
            f"캠페인 {len(items)}개 (진행 {on_count} · 일시정지 {off_count})"
            f" · 일예산 합계 {int(total_budget):,}원"
        )
        return {
            "count": len(items),
            "items": items,
            "summary": summary,
            "raw": data,
        }
  • Helper: fetch_details() used to make concurrent detail API calls per campaign ID; extract_rows() to normalize list response formats.
    async def fetch_details(
        client: KakaoMomentClient,
        path_template: str,
        ids: list[Any],
    ) -> dict[Any, dict[str, Any]]:
        """ID 리스트를 받아 path_template.format(id=...) 로 detail 을 동시 조회한다.
    
        카카오모먼트의 list 엔드포인트는 daily_budget/bid_amount 등을 포함하지 않으므로
        list 한 뒤 각 항목의 detail 을 N+1 로 받아 보강한다. 동시 호출은 카카오 레이트리밋
        완화를 위해 _DETAIL_CONCURRENCY 로 제한.
    
        실패한 ID 는 dict 에서 누락된다(빈 dict). 호출 측은 .get(id, {}) 패턴으로 안전 접근.
        """
        sem = asyncio.Semaphore(_DETAIL_CONCURRENCY)
    
        async def one(item_id: Any) -> tuple[Any, dict[str, Any]]:
            async with sem:
                try:
                    data = await client.get(path_template.format(id=item_id))
                except Exception:  # noqa: BLE001 — detail 실패는 silent (raw fallback)
                    return item_id, {}
            body = data.get("data") if isinstance(data, dict) and "data" in data else data
            return item_id, body if isinstance(body, dict) else {}
    
        results = await asyncio.gather(*(one(i) for i in ids if i is not None))
        return {k: v for k, v in results}
Behavior3/5

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

No annotations exist, so the description must disclose behavior. It mentions performance implications (with_details False when slow), but does not explicitly state that the operation is read-only or safe. The description adds some behavioral context but misses the opportunity to fully assure agents about safety.

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?

The description is front-loaded with a purpose statement and structured with example queries and an Args section. It is concise overall, though the example list could be slightly trimmed. Every sentence adds value.

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?

For a simple list tool with no output schema, the description sufficiently explains the return fields (name, status, daily budget, type) and provides filtering and performance guidance. The sibling tools are distinct, so no cross-referencing is needed. The description is complete for its context.

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

Parameters5/5

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

With 0% schema description coverage, the description fully compensates by explaining the status_filter values with concrete examples and defining the with_details boolean's effect and performance trade-off. This is far beyond what the schema provides.

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 starts with a clear Korean sentence stating the tool retrieves a full campaign list with specific fields (name, status, daily budget, type). The subsequent example queries reinforce the exact purpose. Although sibling tools are different, the description's clarity eliminates ambiguity.

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

Usage Guidelines4/5

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

The description provides example queries and explains when to use the status_filter and with_details parameters, including advice on turning off with_details for performance. However, it does not explicitly compare to sibling tools or state when not to use this tool, which would improve guidance.

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/jun7680/kakao-moment-mcp'

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