Skip to main content
Glama
flyanima

Open Search MCP

by flyanima

jsonplaceholder_comments

Retrieve test comments data from JSONPlaceholder for development and testing purposes, with optional filtering by post ID and configurable result limits.

Instructions

Get test comments data from JSONPlaceholder

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
postIdNoPost ID to get comments for (1-100, optional)
limitNoMaximum number of comments to return (1-100)

Implementation Reference

  • The main handler function that executes the tool logic. It fetches comments from the JSONPlaceholder API using the client instance and formats the response with success status, data, and error handling.
      execute: async (args: any) => {
        try {
          const comments = await client.getComments(args.postId, args.limit || 10);
          
          return {
            success: true,
            data: {
              source: 'JSONPlaceholder API',
              type: 'comments',
              postId: args.postId,
              results: comments,
              count: comments.length,
              timestamp: Date.now(),
              apiUsed: true
            }
          };
        } catch (error) {
          return {
            success: false,
            error: error instanceof Error ? error.message : 'Failed to get test comments'
          };
        }
      }
    });
  • Registers the 'jsonplaceholder_comments' tool with the ToolRegistry, including name, description, input schema, and the execute handler.
    registry.registerTool({
      name: 'jsonplaceholder_comments',
      description: 'Get test comments data from JSONPlaceholder',
      category: 'testing',
      source: 'jsonplaceholder.typicode.com',
      inputSchema: {
        type: 'object',
        properties: {
          postId: {
            type: 'number',
            description: 'Post ID to get comments for (1-100, optional)'
          },
          limit: {
            type: 'number',
            description: 'Maximum number of comments to return (1-100)',
            default: 10,
            minimum: 1,
            maximum: 100
          }
        },
        required: []
      },
      execute: async (args: any) => {
        try {
          const comments = await client.getComments(args.postId, args.limit || 10);
          
          return {
            success: true,
            data: {
              source: 'JSONPlaceholder API',
              type: 'comments',
              postId: args.postId,
              results: comments,
              count: comments.length,
              timestamp: Date.now(),
              apiUsed: true
            }
          };
        } catch (error) {
          return {
            success: false,
            error: error instanceof Error ? error.message : 'Failed to get test comments'
          };
        }
      }
    });
  • Zod schema definition used for input validation specific to the jsonplaceholder_comments tool in the global input validator.
    'jsonplaceholder_comments': z.object({
      postId: z.number().int().min(1).max(100).optional(),
      limit: z.number().int().min(1).max(100).optional().default(10)
    }),
  • Helper method in JSONPlaceholderAPIClient class that constructs the API endpoint for comments and fetches/slices the data, used by the tool handler.
    async getComments(postId?: number, limit?: number) {
      const endpoint = postId ? `/posts/${postId}/comments` : '/comments';
      const comments = await this.makeRequest(endpoint);
      return limit ? comments.slice(0, limit) : comments;
    }
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 but offers minimal information. It doesn't mention whether this is a read-only operation, what format the data returns in, potential rate limits, authentication requirements, or error conditions. The description only states what data is retrieved without behavioral context.

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 extremely concise at just one sentence with zero wasted words. It's front-loaded with the core purpose and efficiently communicates the essential function without unnecessary elaboration, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is insufficiently complete. It doesn't explain what the return data looks like, how comments are structured, or provide any context about JSONPlaceholder as a testing service. For a data retrieval tool with multiple parameters, more contextual information would help the agent use it effectively.

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 description adds no parameter information beyond what's already in the schema, which has 100% coverage with clear descriptions for both parameters. The baseline score of 3 reflects adequate parameter documentation through the schema alone, though the description doesn't enhance understanding of when or how to use these parameters effectively.

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 action ('Get') and resource ('test comments data from JSONPlaceholder'), making the purpose immediately understandable. It distinguishes from some siblings like 'jsonplaceholder_posts' by specifying 'comments', but doesn't explicitly differentiate from other JSONPlaceholder tools like 'jsonplaceholder_albums' or 'jsonplaceholder_users' beyond 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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any specific use cases, prerequisites, or comparisons with sibling tools like 'jsonplaceholder_posts' or 'test_jsonplaceholder', leaving the agent to infer usage context entirely from the tool name and parameters.

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/flyanima/open-search-mcp'

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