marketo_get_landing_page_by_id
Fetch a Marketo landing page by ID and obtain detailed metadata such as template, URL, content sections, and form embeds.
Instructions
Get a single Marketo landing page by ID. Returns full LP metadata including template, URL, content sections, and form embeds.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Landing page ID |
Implementation Reference
- src/tools/landingPages.ts:26-38 (handler)The tool handler for marketo_get_landing_page_by_id. It takes a single `id` parameter (number) and makes a GET request to `/rest/asset/v1/landingPage/{id}.json` to retrieve the Marketo landing page by its ID.
// ── marketo_get_landing_page_by_id ───────────────────────────────────────── server.tool( "marketo_get_landing_page_by_id", "Get a single Marketo landing page by ID. Returns full LP metadata including template, URL, content sections, and form embeds.", { id: z.number().describe("Landing page ID"), }, async (args) => { try { return ok(await makeRequest(`/rest/asset/v1/landingPage/${args.id}.json`)); } catch (e) { return err(e); } } ); - src/tools/landingPages.ts:30-32 (schema)Input schema for the tool: requires an `id` field of type `z.number()` describing the Landing page ID.
{ id: z.number().describe("Landing page ID"), }, - src/tools/landingPages.ts:27-28 (registration)Tool registration on the MCP server via `server.tool()` with the name 'marketo_get_landing_page_by_id'. The containing function `registerLandingPageTools` is called from src/index.ts line 28.
server.tool( "marketo_get_landing_page_by_id", - src/client.ts:21-49 (helper)The `makeRequest` helper function used by the handler to perform the authenticated HTTP call to the Marketo REST 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; }