Skip to main content
Glama
ZLeventer

linkedin-campaign-manager-mcp

li_get_campaign

Retrieve complete campaign details including targeting criteria, bid strategy, budget, and schedule to audit targeting setup, diagnose budget configuration, or confirm campaign structure.

Instructions

Get complete detail for a single LinkedIn campaign, including the full targetingCriteria object (all included/excluded facets), bid strategy, unit cost, daily/total budget, run schedule, objective, optimization target, format, and locale. Use this when you need to audit targeting setup, diagnose budget configuration, or confirm campaign structure before pulling performance data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaign_idYesCampaign numeric ID or URN (urn:li:sponsoredCampaign:123). Required.
ad_account_idNoAd account numeric ID or URN. Defaults to LINKEDIN_DEFAULT_AD_ACCOUNT.

Implementation Reference

  • The actual handler function for li_get_campaign. It resolves the ad account, unwraps the campaign URN, and performs a GET request to the LinkedIn API endpoint /adAccounts/{accountId}/adCampaigns/{campaignId}.
    export async function getCampaign(args: { campaign_id: string; ad_account_id?: string }) {
      const account = resolveAdAccount(args.ad_account_id);
      const accountId = unwrapURN(account);
      const campaignId = unwrapURN(urn("sponsoredCampaign", args.campaign_id));
      return liGet(`/adAccounts/${accountId}/adCampaigns/${campaignId}`);
    }
  • Zod schema for li_get_campaign input validation. Requires campaign_id (string) and optionally ad_account_id (string) which defaults to LINKEDIN_DEFAULT_AD_ACCOUNT.
    export const getCampaignSchema = {
      campaign_id: z
        .string()
        .describe("Campaign numeric ID or URN (urn:li:sponsoredCampaign:123). Required."),
      ad_account_id: z
        .string()
        .optional()
        .describe("Ad account numeric ID or URN. Defaults to LINKEDIN_DEFAULT_AD_ACCOUNT."),
    };
  • src/index.ts:81-86 (registration)
    Registration of the 'li_get_campaign' tool on the MCP server, binding the schema and handler function.
    server.tool(
      "li_get_campaign",
      "Get complete detail for a single LinkedIn campaign, including the full targetingCriteria object (all included/excluded facets), bid strategy, unit cost, daily/total budget, run schedule, objective, optimization target, format, and locale. Use this when you need to audit targeting setup, diagnose budget configuration, or confirm campaign structure before pulling performance data.",
      getCampaignSchema,
      async (args) => { try { return ok(await getCampaign(args)); } catch (e) { return err(e); } }
    );
  • The urn() helper function used by getCampaign to wrap a bare ID into a LinkedIn URN.
    /** Wrap a bare ID in a LinkedIn URN. Idempotent — already-URN inputs pass through. */
    export function urn(type: URNType, id: string | number): string {
      const s = String(id).trim();
      if (s.startsWith("urn:li:")) return s;
      return `urn:li:${type}:${s}`;
    }
  • The unwrapURN() helper function used by getCampaign to extract the numeric ID from a URN.
    export function unwrapURN(u: string): string {
      const parts = u.split(":");
      return parts[parts.length - 1] ?? u;
    }
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It states what is returned (full detail) but does not explicitly declare that the tool is read-only or has no side effects. However, the context implies a read operation, and the description is transparent about the output.

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 two sentences, front-loaded with the primary action and details, and the second sentence provides usage context. Every word is necessary and informative.

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?

Despite no output schema, the description lists many returned fields (targetingCriteria, bid strategy, budget, etc.), giving a complete picture of what the agent can expect. For a tool with moderate complexity, this is thorough.

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?

The input schema already covers both parameters with descriptions. The description adds value by noting that campaign_id is required and ad_account_id defaults to LINKEDIN_DEFAULT_AD_ACCOUNT, providing operational context beyond the 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 explicitly states the tool retrieves 'complete detail for a single LinkedIn campaign' and enumerates specific elements like targetingCriteria, bid strategy, etc., clearly distinguishing it from sibling tools like li_get_campaign_performance.

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 clear guidance on when to use the tool: 'audit targeting setup, diagnose budget configuration, or confirm campaign structure before pulling performance data.' This helps an agent select the right tool.

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/ZLeventer/linkedin-campaign-manager-mcp'

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