Skip to main content
Glama

list_published_posts

List published posts with pagination. Returns title, date, slug, and URL for each post. Control results with offset and limit parameters.

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)
    Tool registration for list_published_posts via server.tool(). Defined with input schema (offset, limit) and async handler that calls client.getPublishedPosts().
    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) }],
        };
      },
    );
  • Handler logic for list_published_posts. Calls client.getPublishedPosts, maps results to summary objects (id, title, subtitle, slug, post_date, audience, word_count, url), and returns JSON response with total count.
      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 for list_published_posts using Zod: offset (optional, default 0) and limit (optional, default 25, capped at 100).
    {
      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)"),
    },
  • API client method getPublishedPosts that calls Substack's /api/v1/post_management/published endpoint with offset/limit pagination, ordered by post_date descending. Returns posts array and total count.
    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 };
    }
  • Type definition for SubstackPost used by getPublishedPosts return type and the summary mapping in the handler.
    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?

No annotations are provided, so the description carries the full burden. It does not disclose whether the operation is read-only or has side effects. While it mentions pagination and return fields, it lacks behavioral traits like authentication requirements or data freshness.

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 a single sentence of 12 words, efficiently stating purpose, key feature, and return fields. It is front-loaded and contains no fluff.

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 absence of an output schema, the description helpfully lists the returned fields. For a simple tool with two parameters, this covers the essential context. It could mention ordering but is fairly complete.

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 input schema fully describes both parameters (offset and limit) with descriptions, achieving 100% coverage. The description adds no additional meaning beyond paraphrasing 'pagination', so a baseline of 3 is appropriate.

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 the action 'List published posts', the resource 'published posts', and includes pagination as a key feature. It also lists the returned fields (title, date, slug, URL), making the tool's purpose specific and distinguishable from sibling tools like get_post or list_drafts.

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?

The description implies usage for listing published posts with pagination but does not explicitly state when to use this tool versus alternatives like get_post for a single post or list_drafts for drafts. No guidance on when not to use it.

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