Skip to main content
Glama

get-video-categories

Retrieve YouTube video categories by region using the MCP server. Specify a region code to fetch relevant categories for targeted search or content organization.

Instructions

Retrieve available video categories for a specific region

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regionCodeNo

Implementation Reference

  • src/index.ts:525-558 (registration)
    Registration of the 'get-video-categories' tool, including input schema (regionCode optional string) and the complete handler function that uses the YouTube Data API v3 to list video categories for the specified region (default 'US'), formats them into id/title objects, and returns as JSON text content.
    server.tool( 'get-video-categories', 'Retrieve available video categories for a specific region', { regionCode: z.string().length(2).optional() }, async ({ regionCode = 'US' }) => { try { const response = await youtubeService.youtube.videoCategories.list({ part: ['snippet'], regionCode }); const categories = response.data.items?.map(category => ({ id: category.id, title: category.snippet?.title })); return { content: [{ type: 'text', text: JSON.stringify(categories, null, 2) }] }; } catch (error) { return { content: [{ type: 'text', text: `Error fetching video categories: ${error}` }], isError: true }; } }
  • The exact handler function implementing the tool logic: calls youtubeService.youtube.videoCategories.list with part 'snippet' and regionCode, maps items to {id, title}, returns JSON stringified in text content, handles errors.
    async ({ regionCode = 'US' }) => { try { const response = await youtubeService.youtube.videoCategories.list({ part: ['snippet'], regionCode }); const categories = response.data.items?.map(category => ({ id: category.id, title: category.snippet?.title })); return { content: [{ type: 'text', text: JSON.stringify(categories, null, 2) }] }; } catch (error) { return { content: [{ type: 'text', text: `Error fetching video categories: ${error}` }], isError: true }; }
  • Input schema using Zod: optional regionCode as 2-character string.
    { regionCode: z.string().length(2).optional() },

Other Tools

Related 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/coyaSONG/youtube-mcp-server'

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