Skip to main content
Glama
jdoliveirasa

erickwendel-contributions-mcp

by jdoliveirasa

get_posts

Retrieve posts with filters by ID, title, language, or portal, and control pagination with skip and limit parameters.

Instructions

Get a list of posts with optional filtering and pagination.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNoFilter posts by ID
titleNoFilter posts by title
languageNoFilter posts by language
portalNoFilter posts by portal
skipNoNumber of posts to skip
limitNoMaximum number of posts to return

Implementation Reference

  • The handler function that executes the get_posts tool logic. It calls fetchPosts, validates result.getPosts exists, formats the response as MCP text content, and handles errors.
      handler: async (params: PostsParams): Promise<McpResponse> => {
        try {
          const result = await fetchPosts(params)
    
          if (!result.getPosts) {
            throw new Error('No results returned from API')
          }
    
          const content: McpTextContent = {
            type: 'text',
            text: `Posts Results:\n\n${JSON.stringify(result.getPosts, null, 2)}`
          }
    
          return {
            content: [content]
          }
        } catch (error) {
          throw new Error(`Failed to fetch posts: ${error.message}`)
        }
      }
    }
  • Zod schema defining the get_posts input parameters: id, title, language, portal (optional strings) and skip (default 0), limit (default 10) (optional numbers).
    parameters: {
      id: z.string().optional().describe('Filter posts by ID'),
      title: z.string().optional().describe('Filter posts by title'),
      language: z.string().optional().describe('Filter posts by language'),
      portal: z.string().optional().describe('Filter posts by portal'),
      skip: z.number().optional().default(0).describe('Number of posts to skip'),
      limit: z.number().optional().default(10).describe('Maximum number of posts to return')
    },
  • TypeScript interface for PostsResponse - defines the shape of the API response including totalCount, retrieved, processedIn, and the posts array with Post fields.
    export interface PostsResponse {
      getPosts: {
        totalCount: number;
        retrieved: number;
        processedIn: number;
        posts: Post[];
      } | null;
    }
  • TypeScript interface for PostsParams - defines the parameters accepted by the get_posts tool handler.
    export interface PostsParams {
      id?: string;
      title?: string;
      language?: string;
      portal?: string;
      skip?: number;
      limit?: number;
    }
  • src/index.ts:29-34 (registration)
    Registration of the getPostsTool on the MCP server via server.tool(), using the tool's name, description, parameters, and handler.
    server.tool(
      getPostsTool.name,
      getPostsTool.description,
      getPostsTool.parameters,
      getPostsTool.handler
    )
  • The fetchPosts function - sends a GraphQL query with getPosts field to the API, requesting post data with optional filtering by id, title, language, portal, skip, and limit.
    export async function fetchPosts (params: {
      id?: string;
      title?: string;
      language?: string;
      portal?: string;
      skip?: number;
      limit?: number;
    }): Promise<PostsResponse> {
      const { id, title, language, portal, skip, limit } = params
      const languageCode = getLanguageCode(language)
    
      return await client.query({
        getPosts: {
          __args: {
            _id: id,
            title,
            language: languageCode,
            portal,
            skip,
            limit
          },
          totalCount: true,
          retrieved: true,
          processedIn: true,
          posts: {
            _id: true,
            title: true,
            abstract: true,
            type: true,
            link: true,
            additionalLinks: true,
            portal: {
              link: true,
              name: true
            },
            tags: true,
            language: true,
            date: true
          }
        }
      }) as PostsResponse
    }
  • Tool configuration defining the name ('get_posts') and description for the posts tool.
    posts: {
      name: 'get_posts',
      description: 'Get a list of posts with optional filtering and pagination.'
    },

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.4

TDQS

B3.3/5.0
Behavior2/5

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

With no annotations, the description carries the full burden, but it only says "Get a list of posts" and mentions filtering/pagination. It does not disclose whether the operation is read-only, requires authentication, has rate limits, or what the response structure is.

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 concise sentence that is front-loaded with the core action and resource. It avoids redundancy and is appropriately sized for a simple list operation.

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?

For a tool with 6 optional parameters and no output schema, this description is minimal but functionally adequate. It lacks context on filtering semantics (e.g., exact vs partial match), ordering, or intended use cases, but the core purpose is clear.

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 baseline is 3. The description echoes the schema by mentioning "optional filtering" but adds no new detail about parameter values, defaults already in the schema, or filtering behavior.

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 tool gets a list of posts, using a specific verb ("Get") and resource ("posts"), and distinguishes it from siblings like get_talks and get_videos by the resource type.

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?

No guidance is provided on when to use this tool versus alternatives. It does not mention that get_talks or get_videos should be used for other content types, or any conditional context for choosing this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools