brave_video_search
Search for video content using Brave Search API, retrieving up to 20 results with titles, URLs, and descriptions for tutorials or media queries.
Instructions
Searches for videos using the Brave Search API. Use this for video content, tutorials, or any media-related queries. Returns a list of videos with titles, URLs, and descriptions. Maximum 20 results per request.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | The number of results to return, minimum 1, maximum 20 | |
| query | Yes | The term to search the internet for videos of |
Implementation Reference
- src/tools/BraveVideoSearchTool.ts:90-105 (handler)The core execution logic of the brave_video_search tool. Performs video search via private videoSearch method, handles empty results, formats output with formatVideoResults, and returns structured content.public async executeCore(input: z.infer<typeof videoSearchInputSchema>) { const { query, count, freshness } = input; const videoSearchResults = await this.videoSearch(query, { count, safesearch: SafeSearchLevel.Strict, ...(freshness ? { freshness } : {}), }); if (!videoSearchResults.results || videoSearchResults.results.length === 0) { this.braveMcpServer.log(`No video results found for "${query}"`); const text = `No video results found for "${query}"`; return { content: [{ type: 'text' as const, text }] }; } const text = formatVideoResults(videoSearchResults.results); return { content: [{ type: 'text' as const, text }] }; }
- Zod input schema defining parameters for brave_video_search: query (required string), count (optional 1-20), freshness (optional enum or date range).const videoSearchInputSchema = z.object({ query: z.string().describe('The term to search the internet for videos of'), count: z.number().min(1).max(20).default(10).optional().describe('The number of results to return, minimum 1, maximum 20'), freshness: z.union([ z.enum(['pd', 'pw', 'pm', 'py']), z.string().regex(/^\d{4}-\d{2}-\d{2}to\d{4}-\d{2}-\d{2}$/, 'Date range must be in format YYYY-MM-DDtoYYYY-MM-DD') ]) .optional() .describe( `Filters search results by when they were discovered. The following values are supported: - pd: Discovered within the last 24 hours. - pw: Discovered within the last 7 Days. - pm: Discovered within the last 31 Days. - py: Discovered within the last 365 Days. - YYYY-MM-DDtoYYYY-MM-DD: Custom date range (e.g., 2022-04-01to2022-07-30)`, ), });
- src/server.ts:70-75 (registration)Registers the brave_video_search tool ('videoSearchTool') with the MCP server by calling server.tool with name, description, input schema, and execute handler.this.server.tool( this.videoSearchTool.name, this.videoSearchTool.description, this.videoSearchTool.inputSchema.shape, this.videoSearchTool.execute.bind(this.videoSearchTool), );
- src/utils.ts:19-35 (helper)Utility function to format an array of BraveVideoResult into a concatenated string of video details separated by '---', used in the tool's executeCore.export function formatVideoResults(results: BraveVideoResult[]) { return (results || []).map((video) => { return `Title: ${video.title}\n` + `URL: ${video.url}\n` + `Description: ${video.description}\n` + `Age: ${video.age}\n` + `Duration: ${video.video.duration}\n` + `Views: ${video.video.views}\n` + `Creator: ${video.video.creator}\n` + `${('requires_subscription' in video.video) ? (video.video.requires_subscription ? 'Requires subscription\n' : 'No subscription\n') : ''} ` + `${('tags' in video.video && video.video.tags) ? (`Tags: ${video.video.tags.join(', ')}`) : ''} ` ; }).join('\n---\n');