Skip to main content
Glama

Search Videos

videos_searchVideos
Read-onlyIdempotent

Find YouTube videos by searching with a query. Returns video URLs and details. Optionally limit results.

Instructions

Search for videos on YouTube and return results with URLs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query
maxResultsNoMaximum number of results to return

Implementation Reference

  • Registration of the 'videos_searchVideos' tool with its input schema. Calls videoService.searchVideos() as the handler.
    server.registerTool(
        'videos_searchVideos',
        {
            title: 'Search Videos',
            description: 'Search for videos on YouTube and return results with URLs',
            annotations: { readOnlyHint: true, idempotentHint: true },
            inputSchema: {
                query: z.string().describe('Search query'),
                maxResults: z.number().optional().describe('Maximum number of results to return'),
            },
        },
        async ({ query, maxResults }) => {
            const result = await videoService.searchVideos({ query, maxResults });
            return {
                content: [{
                    type: 'text',
                    text: JSON.stringify(result, null, 2)
                }]
            };
        }
    );
  • The actual implementation of the searchVideos handler in VideoService class. Calls YouTube API search.list with the query and maxResults parameters, then structures the results.
    async searchVideos({
      query,
      maxResults = 10
    }: SearchParams): Promise<unknown[]> {
      try {
        this.initialize();
    
        const response = await this.youtube.search.list({
          part: ['snippet'],
          q: query,
          maxResults,
          type: ['video']
        });
    
        const videos = response.data.items || [];
        return this.createStructuredVideos(videos);
      } catch (error) {
        throw new Error(`Failed to search videos: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • The SearchParams interface defining input types for searchVideos: query (string, required) and maxResults (number, optional).
    export interface SearchParams {
      query: string;
      maxResults?: number;
    }
  • Helper method createStructuredVideos used by searchVideos to add structured URL data to each video result.
    private createStructuredVideos(videos: unknown[]): unknown[] {
      return videos.map(video => this.createStructuredVideo(video)).filter(Boolean);
    }
  • The tool name listed in the static 'info' resource for Smithery discovery.
    tools: [
        "videos_getVideo",
        "videos_searchVideos",
        "transcripts_getTranscript",
        "channels_getChannel",
        "channels_listVideos",
        "playlists_getPlaylist",
        "playlists_getPlaylistItems"
    ],
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint and idempotentHint, which cover the main behavioral traits. The description adds no further behavioral details (e.g., rate limits, default maxResults, error handling). With annotations present, the bar is lower, and the description does not contradict them. Score is neutral.

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, concise sentence that efficiently conveys the tool's purpose. It is front-loaded and lacks unnecessary fluff, but could be slightly more structured (e.g., include output details) without becoming verbose.

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 lack of an output schema, the description should provide more context about the return format. It only mentions 'URLs' but does not clarify if other fields (e.g., video ID, title) are included. For a search tool, this omission reduces completeness.

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?

Input schema has 100% coverage with descriptions for both parameters ('query' and 'maxResults'). The description does not add any additional meaning beyond what the schema already provides, so it meets the baseline.

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

Purpose5/5

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

The description clearly states the tool's action ('Search for videos on YouTube') and what it returns ('results with URLs'). It is specific and distinguishes this from sibling tools like channels_getChannel or playlists_getPlaylistItems, which focus on other resources.

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

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not provide explicit guidance on when to use this tool versus alternatives. While the sibling tools are different, there is no mention of when search is preferred over listing or getting specific videos. Usage context is only implied.

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

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