Skip to main content
Glama
alexleventer

Marketo MCP Server

by alexleventer

marketo_get_programs

List Marketo programs filtered by type, date range, or tag. Retrieve program metadata including channel, status, costs, and tags with pagination.

Instructions

List programs in Marketo. Filter by type (filterType: id, programType, folder, tag) with filterValues, or by date range (earliestUpdatedAt/latestUpdatedAt). Paginate with maxReturn/offset. Returns program metadata including channel, status, costs, and tags.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxReturnNo
offsetNo
filterTypeNo
filterValuesNo
earliestUpdatedAtNo
latestUpdatedAtNo

Implementation Reference

  • Handler function for marketo_get_programs tool. Builds query params (maxReturn, offset, filterType, filterValues, earliestUpdatedAt, latestUpdatedAt) and calls makeApiRequest to GET /asset/v1/programs.json
      tool(async ({ maxReturn = 200, offset = 0, filterType, filterValues, earliestUpdatedAt, latestUpdatedAt }) => {
        const params = new URLSearchParams({
          maxReturn: maxReturn.toString(),
          offset: offset.toString(),
        });
        if (filterType) params.append('filterType', filterType);
        if (filterValues) params.append('filterValues', filterValues);
        if (earliestUpdatedAt) params.append('earliestUpdatedAt', earliestUpdatedAt);
        if (latestUpdatedAt) params.append('latestUpdatedAt', latestUpdatedAt);
        return makeApiRequest(`/asset/v1/programs.json?${params.toString()}`, 'GET');
      })
    );
  • src/index.ts:421-443 (registration)
    Registration of the marketo_get_programs tool using server.tool() with name, description, Zod schema for inputs (maxReturn, offset, filterType, filterValues, earliestUpdatedAt, latestUpdatedAt), and handler
    server.tool(
      'marketo_get_programs',
      'List programs in Marketo. Filter by type (filterType: id, programType, folder, tag) with filterValues, or by date range (earliestUpdatedAt/latestUpdatedAt). Paginate with maxReturn/offset. Returns program metadata including channel, status, costs, and tags.',
      {
        maxReturn: z.number().optional(),
        offset: z.number().optional(),
        filterType: z.enum(['id', 'programType', 'folder', 'tag']).optional(),
        filterValues: z.string().optional(),
        earliestUpdatedAt: z.string().optional(),
        latestUpdatedAt: z.string().optional(),
      },
      tool(async ({ maxReturn = 200, offset = 0, filterType, filterValues, earliestUpdatedAt, latestUpdatedAt }) => {
        const params = new URLSearchParams({
          maxReturn: maxReturn.toString(),
          offset: offset.toString(),
        });
        if (filterType) params.append('filterType', filterType);
        if (filterValues) params.append('filterValues', filterValues);
        if (earliestUpdatedAt) params.append('earliestUpdatedAt', earliestUpdatedAt);
        if (latestUpdatedAt) params.append('latestUpdatedAt', latestUpdatedAt);
        return makeApiRequest(`/asset/v1/programs.json?${params.toString()}`, 'GET');
      })
    );
  • Input schema for marketo_get_programs: maxReturn (optional number), offset (optional number), filterType (enum: id/programType/folder/tag), filterValues (optional string), earliestUpdatedAt (optional string), latestUpdatedAt (optional string)
    {
      maxReturn: z.number().optional(),
      offset: z.number().optional(),
      filterType: z.enum(['id', 'programType', 'folder', 'tag']).optional(),
      filterValues: z.string().optional(),
      earliestUpdatedAt: z.string().optional(),
      latestUpdatedAt: z.string().optional(),
    },
  • makeApiRequest helper function used by the handler to make HTTP requests to Marketo API with auth token
    async function makeApiRequest(
      endpoint: string,
      method: string,
      data?: any,
      contentType: string = 'application/json'
    ) {
      const token = await tokenManager.getToken();
      const headers: Record<string, string> = {
        Authorization: `Bearer ${token}`,
      };
    
      if (contentType) {
        headers['Content-Type'] = contentType;
      }
    
      try {
        const response = await axios({
          url: `${MARKETO_BASE_URL}${endpoint}`,
          method,
          data:
            contentType === 'application/x-www-form-urlencoded'
              ? new URLSearchParams(data).toString()
              : data,
          headers,
        });
        return response.data;
      } catch (error: any) {
        console.error('API request failed:', error.response?.data || error.message);
        throw error;
      }
    }
  • tool() wrapper helper function that wraps handlers with try/catch and formats responses as MCP content blocks
    function tool<T>(handler: (args: T) => Promise<unknown>) {
      return async (args: T) => {
        try {
          const response = await handler(args);
          return {
            content: [{ type: 'text' as const, text: JSON.stringify(response, null, 2) }],
          };
        } catch (error: any) {
          return {
            content: [
              {
                type: 'text' as const,
                text: `Error: ${error.response?.data?.message || error.message}`,
              },
            ],
            isError: true,
          };
        }
      };
Behavior3/5

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

No annotations are provided, so the description must fully convey behavioral traits. It correctly implies a read-only operation ('List programs') and mentions return data, but lacks details on authentication needs, rate limits, or potential side effects. The description is adequate but not richly transparent.

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 concise, comprising two efficient sentences. The first sentence states the primary action, and the second covers parameters and return data. No extraneous information.

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?

Given the tool has 6 parameters, no required fields, and no output schema, the description covers the main aspects: filtering, pagination, and return fields (channel, status, costs, tags). It misses details like sorting, error responses, or default pagination limits, but is reasonably complete for a list operation.

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

Parameters4/5

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

The description adds significant meaning beyond the raw schema: it explains filterType's enumerated values (id, programType, folder, tag), the role of filterValues, date range parameters, and pagination controls. However, it omits details like value format or default behaviors, which slightly reduces clarity.

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 'List programs in Marketo' and details the filtering and pagination options, making the tool's purpose unambiguous. It distinguishes from siblings like get_program_by_id which retrieves a single program.

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

Usage Guidelines4/5

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

The description explains how to use the tool with filter types, values, date range, and pagination, but does not explicitly state when to use it over alternatives or when not to use it. The sibling list provides context but no direct guidance.

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

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