Skip to main content
Glama

brave_image_search

Search the web for images using the Brave Search API by entering a search term and specifying the number of results, up to three at a time.

Instructions

A tool for searching the web for images using the Brave Search API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNoThe number of images to search for, minimum 1, maximum 3
searchTermYesThe term to search the internet for images of

Implementation Reference

  • Core execution logic for the 'brave_image_search' tool: performs image search with BraveSearch API, converts images to base64, stores in internal map, constructs content blocks with text titles and image data, notifies resource changes.
    public async executeCore(input: z.infer<typeof imageSearchInputSchema>) { const { searchTerm, count } = input; this.server.log(`Searching for images of "${searchTerm}" with count ${count}`, 'debug'); const imageResults = await this.braveSearch.imageSearch(searchTerm, { count, safesearch: SafeSearchLevel.Strict, }); this.server.log(`Found ${imageResults.results.length} images for "${searchTerm}"`, 'debug'); const base64Strings = []; const titles = []; for (const result of imageResults.results) { const base64 = await imageToBase64(result.properties.url); this.server.log(`Image base64 length: ${base64.length}`, 'debug'); titles.push(result.title); base64Strings.push(base64); this.imageByTitle.set(result.title, base64); } const results = []; for (const [index, title] of titles.entries()) { results.push({ type: 'text', text: `${title}`, }); results.push({ type: 'image', data: base64Strings[index], mimeType: 'image/png', }); } this.server.resourceChangedNotification(); return { content: results }; }
  • Zod input schema for 'brave_image_search' tool defining parameters: searchTerm (required string) and count (optional number, 1-3, default 1).
    const imageSearchInputSchema = z.object({ searchTerm: z.string().describe('The term to search the internet for images of'), count: z.number().min(1).max(3).optional().default(1).describe('The number of images to search for, minimum 1, maximum 3'), });
  • src/server.ts:46-51 (registration)
    Registers the 'brave_image_search' tool with the MCP server by calling server.tool() with the tool's name, description, input schema shape, and bound execute method.
    this.server.tool( this.imageSearchTool.name, this.imageSearchTool.description, this.imageSearchTool.inputSchema.shape, this.imageSearchTool.execute.bind(this.imageSearchTool), );

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/mikechao/brave-search-mcp'

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