get_logo_url
Retrieve customizable logo image URLs for company domains with options for size, format, theme, and greyscale conversion.
Instructions
Get a direct logo image URL for a specific domain. Supports customization options like size, format, theme, and more.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | The company domain (e.g., 'google.com', 'apple.com') | |
| size | No | Logo size/dimensions (optional) | |
| format | No | Image format (default: png) | |
| theme | No | Logo theme variant (optional) | |
| greyscale | No | Convert logo to greyscale (default: false) |
Implementation Reference
- src/index.ts:112-157 (handler)The handler function that implements the core logic of the get_logo_url tool. It creates query parameters with the API token and optional customizations, builds the full logo image URL, formats a JSON response, and handles any errors.async ({ domain, size, format, theme, greyscale }) => { try { const params = new URLSearchParams({ token: config.apiKey, }); if (size) params.append("size", size); if (format) params.append("format", format); if (theme) params.append("theme", theme); if (greyscale) params.append("greyscale", "true"); const logoUrl = `${LOGO_DEV_IMG_BASE}/${domain}?${params.toString()}`; return { content: [ { type: "text" as const, text: JSON.stringify( { domain, logoUrl, options: { size: size || "default", format: format || "png", theme: theme || "default", greyscale: greyscale || false, }, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text" as const, text: `Error generating logo URL: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }
- src/index.ts:106-111 (schema)The Zod input schema defining the parameters for the get_logo_url tool: required 'domain' and optional 'size', 'format', 'theme', 'greyscale'.domain: z.string().describe("The company domain (e.g., 'google.com', 'apple.com')"), size: z.string().optional().describe("Logo size/dimensions (optional)"), format: z.enum(["png", "jpg", "webp"]).optional().describe("Image format (default: png)"), theme: z.enum(["light", "dark"]).optional().describe("Logo theme variant (optional)"), greyscale: z.boolean().optional().describe("Convert logo to greyscale (default: false)"), },
- src/index.ts:102-158 (registration)The complete registration of the get_logo_url tool on the MCP server using server.tool(), which includes the tool name, description, input schema, and the handler function.server.tool( "get_logo_url", "Get a direct logo image URL for a specific domain. Supports customization options like size, format, theme, and more.", { domain: z.string().describe("The company domain (e.g., 'google.com', 'apple.com')"), size: z.string().optional().describe("Logo size/dimensions (optional)"), format: z.enum(["png", "jpg", "webp"]).optional().describe("Image format (default: png)"), theme: z.enum(["light", "dark"]).optional().describe("Logo theme variant (optional)"), greyscale: z.boolean().optional().describe("Convert logo to greyscale (default: false)"), }, async ({ domain, size, format, theme, greyscale }) => { try { const params = new URLSearchParams({ token: config.apiKey, }); if (size) params.append("size", size); if (format) params.append("format", format); if (theme) params.append("theme", theme); if (greyscale) params.append("greyscale", "true"); const logoUrl = `${LOGO_DEV_IMG_BASE}/${domain}?${params.toString()}`; return { content: [ { type: "text" as const, text: JSON.stringify( { domain, logoUrl, options: { size: size || "default", format: format || "png", theme: theme || "default", greyscale: greyscale || false, }, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text" as const, text: `Error generating logo URL: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } } );
- src/index.ts:8-8 (helper)Constant helper defining the base URL for logo images, used in the get_logo_url handler to construct the final URL.const LOGO_DEV_IMG_BASE = "https://img.logo.dev";