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.'
    },
Behavior3/5

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

With no annotations, the description carries full burden. It correctly implies a read operation ('Get a list'), but does not disclose any side effects, permissions, or rate limits. For a simple list tool, this is adequate but not insightful.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that front-loads the main action and mentions key features. No unnecessary words, but could be slightly more structured to separate filtering from pagination.

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 simple operation (list posts with filters) and complete schema, the description sufficiently covers the tool's function. No output schema is provided, but the return type is implied; for a basic list tool, this is complete enough.

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?

Input schema has 100% coverage, so each parameter is already documented. The description adds only the high-level concept of 'filtering and pagination' without explaining parameter roles or constraints, which is baseline value given the schema richness.

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 'Get' and resource 'posts', and mentions optional filtering and pagination. Although it does not explicitly differentiate from sibling tools (e.g., get_talks, get_videos), the resource name is distinct enough to infer purpose.

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 mentions optional filtering and pagination but provides no guidance on when to use this tool versus alternatives, no prerequisites, and no exclusions. It lacks explicit context for decision-making.

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/jdoliveirasa/contributions-mcp'

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