Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
contextNoDesign context to queryall

Implementation Reference

  • 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) }];
    }
  • 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' },
      },
    };
  • 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';
    }
  • 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());
      });
    }
  • 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;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description indicates a read operation and mentions optional base64 data, but lacks details on permissions, side effects, or exact metadata structure, making it moderately transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two concise sentences with no superfluous information, efficiently covering the tool's purpose and output.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter retrieval tool with full schema coverage, the description adequately covers functionality and output, though it could mention default behavior or filtering options.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the description adds only 'with usage context' which aligns with the 'context' parameter, but does not enhance understanding beyond the schema's enum descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it retrieves texture and pattern assets with usage context, and specifies it returns metadata and optionally base64 image data, distinctly differentiating it from sibling tools like get_colors and get_logos.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context for querying textures but does not provide explicit guidance on when to use this tool versus alternatives or when not to use it, relying on the tool name and context parameter.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/ejwhite7/brandkit-mcp'

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