Skip to main content
Glama

list_canvases

Retrieve all Instant Experience (Canvas) creatives from your ad account. Supports field selection and pagination.

Instructions

List Instant Experience (Canvas) creatives in the ad account.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldsNoComma-separated fields to return
limitNoNumber of results (default 25)
afterNoPagination cursor for next page

Implementation Reference

  • Contains the tool handler for list_canvases (lines 6-27) along with other canvas tools. The handler calls client.get to fetch canvases from the ad account and returns the result as text.
    import { z } from "zod";
    import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
    import { AdsClient } from "../services/ads-client.js";
    
    export function registerCanvasTools(server: McpServer, client: AdsClient): void {
      // ─── list_canvases ─────────────────────────────────────────
      server.tool(
        "list_canvases",
        "List Instant Experience (Canvas) creatives in the ad account.",
        {
          fields: z.string().optional().describe("Comma-separated fields to return"),
          limit: z.number().optional().default(25).describe("Number of results (default 25)"),
          after: z.string().optional().describe("Pagination cursor for next page"),
        },
        async ({ fields, limit, after }) => {
          try {
            const params: Record<string, unknown> = {};
            if (fields) params.fields = fields;
            if (limit) params.limit = limit;
            if (after) params.after = after;
            const { data, rateLimit } = await client.get(`${client.accountPath}/canvas`, 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 };
          }
        }
      );
    
      // ─── get_canvas ────────────────────────────────────────────
      server.tool(
        "get_canvas",
        "Get details of a specific Instant Experience (Canvas) by ID.",
        {
          canvas_id: z.string().describe("Canvas ID"),
          fields: z.string().optional().describe("Comma-separated fields to return"),
        },
        async ({ canvas_id, fields }) => {
          try {
            const params: Record<string, unknown> = {};
            if (fields) params.fields = fields;
            const { data, rateLimit } = await client.get(`/${canvas_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 };
          }
        }
      );
    
      // ─── create_canvas ─────────────────────────────────────────
      server.tool(
        "create_canvas",
        "Create a new Instant Experience (Canvas) on a Facebook Page. Requires page_id and body_elements JSON array defining the canvas layout.",
        {
          page_id: z.string().describe("Facebook Page ID to create the canvas on"),
          body_elements: z.string().describe("JSON array of canvas body elements (buttons, carousels, photos, videos, text, etc.)"),
          name: z.string().optional().describe("Canvas name"),
        },
        async ({ page_id, body_elements, name }) => {
          try {
            const params: Record<string, unknown> = { body_elements };
            if (name) params.name = name;
            const { data, rateLimit } = await client.post(`/${page_id}/canvases`, 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 };
          }
        }
      );
    
      // ─── delete_canvas ─────────────────────────────────────────
      server.tool(
        "delete_canvas",
        "Delete an Instant Experience (Canvas). This action is irreversible.",
        {
          canvas_id: z.string().describe("Canvas ID to delete"),
        },
        async ({ canvas_id }) => {
          try {
            const { data, rateLimit } = await client.delete(`/${canvas_id}`);
            return { content: [{ type: "text" as const, text: JSON.stringify({ success: true, ...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 };
          }
        }
      );
    }
  • registerCanvasTools function registers all canvas tools (including list_canvases) on the McpServer via server.tool().
    export function registerCanvasTools(server: McpServer, client: AdsClient): void {
      // ─── list_canvases ─────────────────────────────────────────
      server.tool(
        "list_canvases",
        "List Instant Experience (Canvas) creatives in the ad account.",
        {
          fields: z.string().optional().describe("Comma-separated fields to return"),
          limit: z.number().optional().default(25).describe("Number of results (default 25)"),
          after: z.string().optional().describe("Pagination cursor for next page"),
        },
        async ({ fields, limit, after }) => {
          try {
            const params: Record<string, unknown> = {};
            if (fields) params.fields = fields;
            if (limit) params.limit = limit;
            if (after) params.after = after;
            const { data, rateLimit } = await client.get(`${client.accountPath}/canvas`, 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 };
          }
        }
      );
    
      // ─── get_canvas ────────────────────────────────────────────
      server.tool(
        "get_canvas",
        "Get details of a specific Instant Experience (Canvas) by ID.",
        {
          canvas_id: z.string().describe("Canvas ID"),
          fields: z.string().optional().describe("Comma-separated fields to return"),
        },
        async ({ canvas_id, fields }) => {
          try {
            const params: Record<string, unknown> = {};
            if (fields) params.fields = fields;
            const { data, rateLimit } = await client.get(`/${canvas_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 };
          }
        }
      );
    
      // ─── create_canvas ─────────────────────────────────────────
      server.tool(
        "create_canvas",
        "Create a new Instant Experience (Canvas) on a Facebook Page. Requires page_id and body_elements JSON array defining the canvas layout.",
        {
          page_id: z.string().describe("Facebook Page ID to create the canvas on"),
          body_elements: z.string().describe("JSON array of canvas body elements (buttons, carousels, photos, videos, text, etc.)"),
          name: z.string().optional().describe("Canvas name"),
        },
        async ({ page_id, body_elements, name }) => {
          try {
            const params: Record<string, unknown> = { body_elements };
            if (name) params.name = name;
            const { data, rateLimit } = await client.post(`/${page_id}/canvases`, 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 };
          }
        }
      );
    
      // ─── delete_canvas ─────────────────────────────────────────
      server.tool(
        "delete_canvas",
        "Delete an Instant Experience (Canvas). This action is irreversible.",
        {
          canvas_id: z.string().describe("Canvas ID to delete"),
        },
        async ({ canvas_id }) => {
          try {
            const { data, rateLimit } = await client.delete(`/${canvas_id}`);
            return { content: [{ type: "text" as const, text: JSON.stringify({ success: true, ...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 };
          }
        }
      );
    }
  • Input schema for list_canvases: optional fields (string), optional limit (number, default 25), optional after (string for pagination).
    {
      fields: z.string().optional().describe("Comma-separated fields to return"),
      limit: z.number().optional().default(25).describe("Number of results (default 25)"),
      after: z.string().optional().describe("Pagination cursor for next page"),
    },
  • src/index.ts:58-58 (registration)
    Where registerCanvasTools is called to wire up the canvas tools including list_canvases.
    registerCanvasTools(server, client);
Behavior2/5

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

No annotations are provided, and the description does not disclose behavioral traits like pagination (despite schema having limit/after), rate limits, authentication, or any side effects beyond listing.

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, concise sentence that directly states the tool's purpose without any extraneous words or repetition.

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?

Given the tool's simplicity (list operation with 3 parameters) and lack of output schema, the description is adequate but incomplete—it does not mention return format, typical use cases, or complement the schema's pagination details.

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 coverage is 100% (all three parameters are described), so baseline is 3. The description adds no additional meaning beyond the schema, such as explaining how 'fields' or 'after' work in context.

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 'List Instant Experience (Canvas) creatives in the ad account,' using a specific verb ('List') and resource ('Canvas creatives'), clearly distinguishing it from sibling tools like list_creatives or get_canvas.

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?

The description provides no guidance on when to use this tool versus alternatives, such as search_targeting or list_creatives, nor does it mention any context or exclusions.

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