Skip to main content
Glama

create_canvas

Create an Instant Experience canvas on a Facebook Page by providing the page ID and a JSON array of body elements defining the layout.

Instructions

Create a new Instant Experience (Canvas) on a Facebook Page. Requires page_id and body_elements JSON array defining the canvas layout.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_idYesFacebook Page ID to create the canvas on
body_elementsYesJSON array of canvas body elements (buttons, carousels, photos, videos, text, etc.)
nameNoCanvas name

Implementation Reference

  • The create_canvas tool handler: registers an MCP tool that creates a new Instant Experience (Canvas) on a Facebook Page. Accepts page_id (required), body_elements (required JSON string), and name (optional). Makes a POST request to /{page_id}/canvases via the AdsClient.
    // ─── 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 };
        }
      }
    );
  • Zod schema for create_canvas input validation: page_id (string, required), body_elements (string, required), name (string, optional).
    {
      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"),
    },
  • src/index.ts:58-58 (registration)
    Registration of the canvas tools (including create_canvas) via registerCanvasTools(server, client) in the main server setup.
    registerCanvasTools(server, client);
  • src/index.ts:136-136 (registration)
    Registration of canvas tools in the sandbox/test server setup.
    registerCanvasTools(sandbox, mockClient);
  • The registerCanvasTools export function that wraps all canvas tool registrations. Imported and called by src/index.ts.
    export function registerCanvasTools(server: McpServer, client: AdsClient): void {

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.0

TDQS

B3.2/5.0
Behavior2/5

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

No annotations are provided, so the description carries full responsibility for behavioral disclosure. It only says 'Create a new Instant Experience' and lists required parameters, but does not mention side effects, permissions, idempotency, or what happens after creation. For a mutation tool, this is a notable gap.

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 concise sentences, immediately states the core purpose, and includes only essential parameter requirements. No filler or redundant content.

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

Completeness2/5

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

While parameters are well documented in the schema, there is no output schema and the description does not explain the return value (e.g., a canvas ID) or any authentication requirements. For a create operation, this missing information makes the description incomplete for an agent to fully understand the tool's behavior.

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 description coverage is 100%, so the schema already documents all three parameters. The description adds 'JSON array defining the canvas layout' for body_elements, which is consistent with the schema but does not provide significant new meaning beyond it.

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 opens with a specific verb and resource: 'Create a new Instant Experience (Canvas) on a Facebook Page.' This clearly states the action and target, and distinguishes it from sibling tools like get_canvas, list_canvases, and delete_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?

There is no guidance about when to use this tool versus alternatives like get_canvas or list_canvases. The description only mentions required parameters ('Requires page_id and body_elements') but does not provide usage context, exclusions, or alternative comparisons.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools