Skip to main content
Glama

list_published_posts

Retrieve published posts with pagination to view titles, dates, slugs, and URLs for content management.

Instructions

List published posts with pagination. Returns title, date, slug, and URL for each post.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
offsetNoNumber of posts to skip
limitNoMax posts to return (1-100)

Implementation Reference

  • src/server.ts:28-51 (registration)
    Registration of the 'list_published_posts' tool using server.tool(), defining the tool name, description, input schema with zod, and the handler function
    server.tool(
      "list_published_posts",
      "List published posts with pagination. Returns title, date, slug, and URL for each post.",
      {
        offset: z.number().optional().default(0).describe("Number of posts to skip"),
        limit: z.number().optional().default(25).describe("Max posts to return (1-100)"),
      },
      async ({ offset, limit }) => {
        const { posts, total } = await client.getPublishedPosts(offset, Math.min(limit, 100));
        const summary = posts.map((p) => ({
          id: p.id,
          title: p.title,
          subtitle: p.subtitle,
          slug: p.slug,
          post_date: p.post_date,
          audience: p.audience,
          word_count: p.word_count,
          url: p.canonical_url,
        }));
        return {
          content: [{ type: "text", text: JSON.stringify({ total, posts: summary }, null, 2) }],
        };
      },
    );
  • The handler function for 'list_published_posts' that calls client.getPublishedPosts(), maps the results to a summary format with id, title, subtitle, slug, post_date, audience, word_count, and url, and returns the JSON response
    async ({ offset, limit }) => {
      const { posts, total } = await client.getPublishedPosts(offset, Math.min(limit, 100));
      const summary = posts.map((p) => ({
        id: p.id,
        title: p.title,
        subtitle: p.subtitle,
        slug: p.slug,
        post_date: p.post_date,
        audience: p.audience,
        word_count: p.word_count,
        url: p.canonical_url,
      }));
      return {
        content: [{ type: "text", text: JSON.stringify({ total, posts: summary }, null, 2) }],
      };
    },
  • Input schema definition using Zod: offset (optional number, default 0) and limit (optional number, default 25, max 100) for pagination
    {
      offset: z.number().optional().default(0).describe("Number of posts to skip"),
      limit: z.number().optional().default(25).describe("Max posts to return (1-100)"),
    },
  • The getPublishedPosts method in SubstackClient that makes the actual HTTP request to Substack's /api/v1/post_management/published endpoint with pagination parameters
    async getPublishedPosts(
      offset = 0,
      limit = 25,
    ): Promise<{ posts: SubstackPost[]; total: number }> {
      const data = await this.request<{ posts: SubstackPost[]; total: number; offset: number; limit: number }>(
        `${this.publicationUrl}/api/v1/post_management/published?offset=${offset}&limit=${limit}&order_by=post_date&order_direction=desc`,
      );
      return { posts: data.posts || [], total: data.total || 0 };
    }
  • TypeScript interface SubstackPost defining the structure of post data returned by the API (id, title, subtitle, slug, post_date, audience, type, canonical_url, word_count, etc.)
    export interface SubstackPost {
      id: number;
      title: string;
      subtitle: string | null;
      slug: string;
      post_date: string | null;
      audience: string;
      type: string;
      draft_title?: string;
      draft_subtitle?: string;
      draft_body?: string;
      body_html?: string;
      canonical_url: string;
      word_count: number;
      description: string | null;
      cover_image: string | null;
      section_id: number | null;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions pagination and return fields, but doesn't cover important aspects like authentication requirements, rate limits, error conditions, or whether this is a read-only operation (though implied by 'List'). For a tool with zero annotation coverage, this is inadequate.

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 perfectly concise - two sentences that each earn their place. The first sentence states the action and key behavioral trait (pagination). The second sentence specifies what's returned. No wasted words, well-structured.

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 2 parameters with 100% schema coverage but no annotations and no output schema, the description provides basic completeness. It covers the core action and return format, but for a list operation that likely involves pagination and filtering considerations, more context about behavior would be helpful. It's minimally adequate but has clear gaps.

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 fully documents both parameters. The description adds no additional parameter information beyond what's in the schema. According to scoring rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('published posts'), and specifies the scope ('published'). However, it doesn't explicitly differentiate from sibling tools like 'list_drafts' or 'get_post', which would require a 5. The purpose is clear but lacks sibling differentiation.

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 like 'list_drafts' or 'get_post'. It mentions pagination but doesn't explain when pagination is needed or when to choose this over other list/retrieval tools. No explicit when/when-not/alternatives are 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/conorbronsdon/substack-mcp'

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