get_logos
Retrieves logo variants with usage guidelines, minimum sizes, clear space rules, and forbidden uses. Optionally returns base64-encoded image data.
Instructions
Get logo variants (primary, mark, wordmark, monochrome) with usage guidelines, minimum sizes, clear space rules, and forbidden uses. Optionally returns base64-encoded image data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| variant | No | Filter by variant name (e.g., 'primary', 'mark', 'wordmark') | |
| format | No | Whether to include base64 data | metadata |
Implementation Reference
- src/tools/get-logos.ts:14-14 (registration)The tool name is exported as 'get_logos', used to register this tool with the MCP server.
export const TOOL_NAME = 'get_logos'; - src/tools/get-logos.ts:16-17 (registration)The tool description, shown in the MCP ListTools response.
export const TOOL_DESCRIPTION = 'Get logo variants (primary, mark, wordmark, monochrome) with usage guidelines, minimum sizes, clear space rules, and forbidden uses. Optionally returns base64-encoded image data.'; - src/tools/get-logos.ts:19-25 (schema)Input schema for get_logos: accepts optional 'variant' (string filter) and 'format' (metadata or base64).
export const INPUT_SCHEMA = { type: 'object' as const, properties: { variant: { type: 'string', description: "Filter by variant name (e.g., 'primary', 'mark', 'wordmark')" }, format: { type: 'string', enum: ['metadata', 'base64'], default: 'metadata', description: 'Whether to include base64 data' }, }, }; - src/tools/get-logos.ts:30-82 (handler)Main handler function. Retrieves logo variants from the design system index, optionally filters by variant name, and optionally includes base64-encoded image data. Returns JSON with variants, usage guidelines, clear space, minimum size, and forbidden usage.
export async function handler(index: DesignSystemIndex, args: GetLogosArgs) { const logos = index.resolved.all.logos; const format = args?.format ?? 'metadata'; let variants = logos.variants; if (args.variant) { variants = variants.filter((v) => v.name.toLowerCase().includes(args.variant!.toLowerCase())); } if (variants.length === 0) { return [{ type: 'text' as const, text: 'No logo variants found matching the criteria.' }]; } // Build variant data, optionally including base64 data URIs const variantData = await Promise.all( variants.map(async (v) => { const entry: Record<string, unknown> = { name: v.name, format: v.format, width: v.width, height: v.height, filePath: v.filePath, }; if (format === 'base64') { const abs = v.source ?? (v.filePath && isAbsolute(v.filePath) ? v.filePath : null) ?? (v.filePath ? resolve(process.cwd(), v.filePath) : null); if (abs && existsSync(abs)) { try { entry.dataUri = await generateBase64DataURI(abs); } catch { entry.dataUriError = 'Could not encode logo as base64'; } } else { entry.dataUriError = 'Logo source file not found'; } } return entry; }), ); const result: Record<string, unknown> = { variants: variantData, usageGuidelines: logos.usageGuidelines, clearSpace: logos.clearSpace, minimumSize: logos.minimumSize, forbiddenUsage: logos.forbiddenUsage, }; return [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }]; } - src/tools/index.ts:84-85 (registration)Registers the get_logos handler in the CallToolRequestSchema switch statement, routing 'get_logos' calls to logos.handler().
case logos.TOOL_NAME: return { content: await logos.handler(index, args as never) };