Skip to main content
Glama

get_image

Retrieve details of a specific ad image by ID. Access fields like URL, dimensions, and status for Facebook and Instagram ad campaigns.

Instructions

Get details of a specific ad image by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
image_idYesImage ID
fieldsNoComma-separated fields to return

Implementation Reference

  • The handler function for the 'get_image' tool. It takes image_id and optional fields parameters, makes a GET request to the ads API using the client to fetch image details, and returns the result as JSON text content.
    async ({ image_id, fields }) => {
      try {
        const params: Record<string, unknown> = {};
        if (fields) params.fields = fields;
        const { data, rateLimit } = await client.get(`/${image_id}`, params);
        return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
      } catch (error) {
        return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
      }
    }
  • The schema/input definition for the 'get_image' tool. Defines two parameters: image_id (required string) and fields (optional string).
    "Get details of a specific ad image by ID.",
    {
      image_id: z.string().describe("Image ID"),
      fields: z.string().optional().describe("Comma-separated fields to return"),
    },
  • Registration of the 'get_image' tool via server.tool() call, which registers it with the MCP server with name 'get_image' and description 'Get details of a specific ad image by ID.'
    // ─── get_image ─────────────────────────────────────────────
    server.tool(
      "get_image",
      "Get details of a specific ad image by ID.",
      {
        image_id: z.string().describe("Image ID"),
        fields: z.string().optional().describe("Comma-separated fields to return"),
      },
      async ({ image_id, fields }) => {
        try {
          const params: Record<string, unknown> = {};
          if (fields) params.fields = fields;
          const { data, rateLimit } = await client.get(`/${image_id}`, params);
          return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
        } catch (error) {
          return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );
  • Imports used by the get_image handler: zod for schema validation, McpServer for tool registration, and AdsClient for HTTP requests to the ads API.
    import { z } from "zod";
    import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
    import { AdsClient } from "../services/ads-client.js";
Behavior3/5

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

No annotations provided, so description bears full burden. States 'get details,' implying no side effects, but does not mention idempotency or authentication needs. Adequate for a read operation but lacks depth.

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?

Single sentence, front-loaded, no extraneous words. Every part contributes to understanding the tool's purpose.

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

Completeness3/5

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

Without an output schema, the description could clarify what 'details' include (e.g., URL, type, metadata). While functional for a simple get tool, it leaves some ambiguity about the return value.

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

Parameters3/5

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

Schema describes both parameters (image_id and fields) with 100% coverage. Description does not add any additional meaning beyond what the schema provides, so baseline score of 3 is appropriate.

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 is specific: 'Get details of a specific ad image by ID.' Clearly identifies the action (get), resource (ad image), and scope (specific, by ID). Distinguishes from sibling tools like list_images (list all) and upload_image/delete_image.

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

Usage Guidelines3/5

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

Implied usage: use when you have an image ID and need its details. No explicit when-to-use or alternatives guidance, which is acceptable for a straightforward read tool but leaves room for improvement given the many siblings.

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/mikusnuz/meta-ads-mcp'

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