Skip to main content
Glama

get contents by user

Retrieve content published by a specific TabNews user, with options to filter by page, quantity, and sorting strategy.

Instructions

get contents by user from tabnews api

Input Schema

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

Implementation Reference

  • Handler function that executes the tool logic: calls the getContentsByUser API service with provided parameters, formats the result as a JSON text response, and handles errors.
    handler: async (params: GetContentByUserParams): Promise<McpResponse> => { try { const result = await getContentsByUser({ username: params.username, 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 by user: ${error.message}`); } else { throw new Error("Failed to get contents by user"); } } },
  • Zod-based input schema definition for the tool parameters: username (required), page, per_page, strategy (optional).
    parameters: { username: z.string().describe("The username to get the contents"), 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"), },
  • src/index.ts:38-43 (registration)
    Registration of the tool on the MCP server instance using the tool object's properties.
    server.tool( getContentsByUserTool.name, getContentsByUserTool.description, getContentsByUserTool.parameters, getContentsByUserTool.handler );

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