Skip to main content
Glama

marketo_get_form_by_id

Retrieve a Marketo form by its ID to access full metadata, including fields, submit button label, and visibility rules.

Instructions

Get a single Marketo form by its ID. Returns full form metadata including fields, submit button label, and visibility rules.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesForm ID

Implementation Reference

  • The handler function for 'marketo_get_form_by_id'. Makes an authenticated GET request to Marketo's Asset API at /rest/asset/v1/form/{id}.json using the shared makeRequest helper.
      async (args) => {
        try {
          return ok(await makeRequest(`/rest/asset/v1/form/${args.id}.json`));
        } catch (e) { return err(e); }
      }
    );
  • Input schema for 'marketo_get_form_by_id': requires a single numeric 'id' parameter.
    {
      id: z.number().describe("Form ID"),
    },
  • Registration of the 'marketo_get_form_by_id' tool via server.tool(), including name, description, schema, and handler.
    server.tool(
      "marketo_get_form_by_id",
      "Get a single Marketo form by its ID. Returns full form metadata including fields, submit button label, and visibility rules.",
      {
        id: z.number().describe("Form ID"),
      },
      async (args) => {
        try {
          return ok(await makeRequest(`/rest/asset/v1/form/${args.id}.json`));
        } catch (e) { return err(e); }
      }
    );
  • The makeRequest helper used by the handler to perform authenticated HTTP requests to the Marketo API.
    export async function makeRequest<T = unknown>(
      endpoint: string,
      method: Method = "GET",
      data?: unknown,
      contentType?: string,
    ): Promise<T> {
      const token = await getAccessToken();
      const config: AxiosRequestConfig = {
        url: `${MARKETO_BASE_URL}${endpoint}`,
        method,
        headers: {
          Authorization: `Bearer ${token}`,
          ...(contentType ? { "Content-Type": contentType } : {}),
        },
        ...(data && method !== "GET" ? { data } : {}),
        ...(data && method === "GET" ? { params: data } : {}),
      };
    
      const res = await axios(config);
      const body = res.data;
    
      // Marketo REST API returns errors inside the response body
      if (body?.errors?.length) {
        const e = body.errors[0];
        throw new MarketoError(`${e.code}: ${e.message}`, res.status);
      }
    
      return body as T;
    }
  • The 'ok' and 'err' response helpers used by the handler to format successful/error responses.
    export function ok(data: unknown) {
      return {
        content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
      };
    }
    
    export function err(e: unknown) {
      const msg = e instanceof Error ? e.message : String(e);
      return {
        isError: true,
        content: [{ type: "text" as const, text: `Error: ${msg}` }],
      };
    }
Behavior3/5

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

No annotations exist; the description indicates it returns metadata but does not cover error handling or permissions. It adequately signals a read operation without explicit safety details.

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?

A single, front-loaded sentence that efficiently conveys purpose and output. No superfluous words.

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

Completeness4/5

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

The description explains what is returned, which compensates for the lack of an output schema. It covers the core functionality adequately for a simple tool.

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?

The schema already describes 'id' as 'Form ID' with 100% coverage. The description adds no further parameter details 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 clearly states it retrieves a single form by ID and details the returned metadata, distinguishing it from the sibling 'marketo_get_forms' which likely lists all forms.

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?

Usage is implied (use when you know the form ID), but no explicit guidance on when to use vs. alternatives like 'marketo_get_forms' is provided.

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/marketo-mcp-server'

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