Skip to main content
Glama

videos_searchVideos

Search YouTube videos by entering a query and specify the maximum number of results to retrieve, enabling efficient content discovery and information gathering.

Instructions

Search for videos on YouTube

Input Schema

NameRequiredDescriptionDefault
maxResultsNoMaximum number of results to return
queryYesSearch query

Input Schema (JSON Schema)

{ "properties": { "maxResults": { "description": "Maximum number of results to return", "type": "number" }, "query": { "description": "Search query", "type": "string" } }, "required": [ "query" ], "type": "object" }

Implementation Reference

  • The core handler function that implements the videos_searchVideos tool by searching YouTube videos using the Google YouTube Data API v3 search.list endpoint.
    async searchVideos({ query, maxResults = 10 }: SearchParams): Promise<any[]> { try { this.initialize(); const response = await this.youtube.search.list({ part: ['snippet'], q: query, maxResults, type: ['video'] }); return response.data.items || []; } catch (error) { throw new Error(`Failed to search videos: ${error instanceof Error ? error.message : String(error)}`); } }
  • src/server.ts:182-190 (registration)
    Dispatch handler in the CallToolRequest that routes the tool call to the videoService.searchVideos method.
    case 'videos_searchVideos': { const result = await videoService.searchVideos(args as unknown as SearchParams); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
  • src/server.ts:63-80 (registration)
    Tool registration definition in the ListTools response, specifying the tool name, description, and input schema.
    { name: 'videos_searchVideos', description: 'Search for videos on YouTube', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query', }, maxResults: { type: 'number', description: 'Maximum number of results to return', }, }, required: ['query'], }, },
  • TypeScript type definition for the input parameters of the videos_searchVideos tool.
    export interface SearchParams { query: string; maxResults?: number; }

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

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