Skip to main content
Glama

get contents

Retrieve content from TabNews API using pagination and sorting strategies to access articles, posts, or discussions.

Instructions

get contents from tabnews api

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoThe page number to get
per_pageNoThe number of contents per page
strategyNoThe strategy to get the contents

Implementation Reference

  • src/index.ts:31-36 (registration)
    Registration of the "get contents" tool on the MCP server by calling server.tool() with the tool's properties.
    server.tool(
      getContentsTool.name,
      getContentsTool.description,
      getContentsTool.parameters,
      getContentsTool.handler
    );
  • The handler function that executes the "get contents" tool logic: fetches data using getContents API helper, formats as JSON text response, handles errors.
    handler: async (params: GetContentsParams): Promise<McpResponse> => {
      try {
        const result = await getContents({
          page: params.page,
          per_page: params.per_page,
          strategy: params.strategy,
        });
    
        const content: McpTextContent = {
          type: "text",
          text: `Contents:\n\n${JSON.stringify(result, null, 2)}`,
        };
    
        return {
          content: [content],
        };
      } catch (error) {
        if (error instanceof Error) {
          throw new Error(`Failed to get contents: ${error.message}`);
        } else {
          throw new Error("Failed to get contents");
        }
      }
    },
  • Zod schema defining input parameters for the "get contents" tool: page, per_page, strategy.
    parameters: {
      page: z.number().optional().describe("The page number to get"),
      per_page: z.number().optional().describe("The number of contents per page"),
      strategy: z
        .enum(["relevant", "new", "old"])
        .optional()
        .describe("The strategy to get the contents"),
    },
  • Helper function getContents that performs the actual API fetch to TabNews /contents endpoint, used by the tool handler.
    export async function getContents({
      page = 1,
      per_page = 30,
      strategy = "relevant",
    }: GetContentsParams = {}): Promise<TabNewsContent[]> {
      const queryParams = new URLSearchParams({
        page: page.toString(),
        per_page: per_page.toString(),
        strategy: strategy,
      });
    
      const response = await fetch(`${TABNEWS_API_URL}/contents?${queryParams}`);
      const data = await response.json();
    
      return data as TabNewsContent[];
    }
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 of behavioral disclosure. It only states the action ('get contents') without detailing traits like pagination behavior, rate limits, authentication needs, or what happens on errors. For a retrieval tool with no annotation coverage, this is a significant gap in transparency.

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, efficient sentence with no wasted words, making it appropriately concise. It could be improved by front-loading more specific information, but it avoids redundancy and is structurally sound.

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 the tool's complexity (3 parameters, no output schema, and no annotations), the description is incomplete. It lacks details on what 'contents' are, how results are returned, or any behavioral context. Without an output schema, the description should ideally hint at the return format, but it doesn't, leaving gaps for the agent.

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%, with clear descriptions for all three parameters (page, per_page, strategy). The description adds no additional meaning beyond what the schema provides, such as explaining the purpose of the strategy options or default behaviors. However, since the schema does the heavy lifting, a baseline score of 3 is appropriate.

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

Purpose2/5

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

The description 'get contents from tabnews api' is a tautology that essentially restates the tool name 'get contents' with minimal additional context. While it specifies the source (tabnews api), it doesn't clarify what 'contents' refers to (e.g., articles, posts, data entries) or distinguish this tool from siblings like 'get content' (singular) or 'get contents by user.' The purpose remains vague beyond the basic retrieval action.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/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 context, prerequisites, or exclusions, nor does it differentiate from sibling tools such as 'get content' or 'get contents by user.' This leaves the agent with no information to make an informed choice among similar tools.

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/renant/mcp-tabnews'

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