Skip to main content
Glama

get content

Retrieve specific content from TabNews API by providing username and slug parameters to access articles or posts.

Instructions

get content from tabnews api

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYesThe username to get the content
slugYesThe slug to get the content

Implementation Reference

  • The handler function that executes the 'get content' tool logic, calling the API service and returning MCP formatted response.
    handler: async (params: GetContentParams): Promise<McpResponse> => { try { const result = await getContent({ username: params.username, slug: params.slug, }); const content: McpTextContent = { type: "text", text: `Content ${params.slug} from ${ params.username }:\n\n${JSON.stringify(result, null, 2)}`, }; return { content: [content], }; } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get content: ${error.message}`); } else { throw new Error("Failed to get content"); } } },
  • Zod schema defining input parameters for the 'get content' tool: username and slug.
    parameters: { username: z.string().describe("The username to get the content"), slug: z.string().describe("The slug to get the content"), },
  • src/index.ts:45-50 (registration)
    Registration of the 'get content' tool with the MCP server using server.tool().
    server.tool( getContentTool.name, getContentTool.description, getContentTool.parameters, getContentTool.handler );
  • Helper function that performs the actual HTTP fetch to retrieve content from TabNews API.
    export async function getContent({ username, slug, }: GetContentParams): Promise<TabNewsContentWithBody> { const response = await fetch( `${TABNEWS_API_URL}/contents/${username}/${slug}` ); const data = await response.json(); return data as TabNewsContentWithBody; }
  • TypeScript interface defining the parameters for getting content.
    export interface GetContentParams { username: string; slug: string; }

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