get_textures
Retrieve texture and pattern assets filtered by design context. Returns metadata with optional base64 image data for use in brand-aligned designs.
Instructions
Get texture and pattern assets with usage context. Returns metadata and optionally base64-encoded image data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context | No | Design context to query | all |
Implementation Reference
- src/tools/get-textures.ts:25-39 (handler)The main handler function for the get_textures tool. It takes a DesignSystemIndex and GetTexturesArgs, resolves the design context, retrieves textures from the resolved index, and returns them as JSON text content.
export function handler(index: DesignSystemIndex, args: GetTexturesArgs) { const ctx = args.context ?? 'all'; const resolved = ctx === 'all' ? index.resolved.all : ctx === 'marketing' ? index.resolved.marketing : ctx === 'product' ? index.resolved.product : index.resolved.all; const textures = resolved.textures; if (textures.length === 0) { return [{ type: 'text' as const, text: `No textures found in ${ctx} context.` }]; } return [{ type: 'text' as const, text: JSON.stringify(textures, null, 2) }]; } - src/tools/get-textures.ts:15-20 (schema)The input schema for the tool, defining a single optional 'context' parameter that can be 'marketing', 'product', 'shared', or 'all' (default).
export const INPUT_SCHEMA = { type: 'object' as const, properties: { context: { type: 'string', enum: ['marketing', 'product', 'shared', 'all'], default: 'all', description: 'Design context to query' }, }, }; - src/types/mcp.ts:113-116 (schema)TypeScript interface GetTexturesArgs defining the typed arguments for the get_textures tool handler.
export interface GetTexturesArgs { /** Filter textures to a specific design context */ context?: 'marketing' | 'product' | 'shared' | 'all'; } - src/tools/index.ts:58-136 (registration)Registration of get_textures in the tools index. The module is imported (line 26) and wired into both ListTools and CallTool request handlers (lines 66-69 for listing, lines 92-93 for dispatching).
export function registerAllTools( server: Server, getIndex: () => DesignSystemIndex, ): void { // ---- Tools -------------------------------------------------------------- server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: ALL_TOOLS.map((t) => ({ name: t.TOOL_NAME, description: t.TOOL_DESCRIPTION, inputSchema: t.INPUT_SCHEMA, })), })); server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args = {} } = request.params; const index = getIndex(); try { switch (name) { case brandOverview.TOOL_NAME: return { content: brandOverview.handler(index) }; case colors.TOOL_NAME: return { content: colors.handler(index, args as never) }; case typography.TOOL_NAME: return { content: typography.handler(index, args as never) }; case logos.TOOL_NAME: return { content: await logos.handler(index, args as never) }; case components.TOOL_NAME: return { content: components.handler(index, args as never) }; case guidelines.TOOL_NAME: return { content: guidelines.handler(index, args as never) }; case tokens.TOOL_NAME: return { content: tokens.handler(index, args as never) }; case textures.TOOL_NAME: return { content: textures.handler(index, args as never) }; case css.TOOL_NAME: return { content: css.handler(index, args as never) }; case searchBrand.TOOL_NAME: return { content: searchBrand.handler(index, args as never) }; case contextDiff.TOOL_NAME: return { content: contextDiff.handler(index, args as never) }; case validateUsage.TOOL_NAME: return { content: validateUsage.handler(index, args as never) }; default: return { content: [{ type: 'text' as const, text: `Unknown tool: ${name}` }], isError: true, }; } } catch (err) { const message = err instanceof Error ? err.message : String(err); return { content: [{ type: 'text' as const, text: `Error executing ${name}: ${message}` }], isError: true, }; } }); // ---- Resources ---------------------------------------------------------- server.setRequestHandler(ListResourcesRequestSchema, async () => ({ resources: listResources(getIndex()), })); server.setRequestHandler(ReadResourceRequestSchema, async (request) => { return readResource(request.params.uri, getIndex()); }); // ---- Prompts ------------------------------------------------------------ server.setRequestHandler(ListPromptsRequestSchema, async () => ({ prompts: listPrompts(), })); server.setRequestHandler(GetPromptRequestSchema, async (request) => { return getPrompt(request.params.name, request.params.arguments ?? {}, getIndex()); }); } - src/types/design-system.ts:199-217 (schema)The DesignTexture interface defining the shape of each texture asset: name, filePath, format, usage, context, and source.
export interface DesignTexture { /** Human-readable texture name */ name: string; /** Relative path to the texture file */ filePath: string; /** File format, e.g. "svg", "png", "jpg" */ format: string; /** Guidance on where or how to apply this texture */ usage?: string; /** Which design context this texture belongs to */ context?: DesignContext; /** File path this was parsed from */ source?: string; }