Skip to main content
Glama
gregkop

Sketchfab MCP Server

by gregkop

sketchfab-search

Search Sketchfab's 3D model library using keywords, tags, and categories to find downloadable models for your projects.

Instructions

Search for 3D models on Sketchfab based on keywords and filters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoText search query (e.g., "car", "house", "character") to find relevant models
tagsNoFilter by specific tags (e.g., ["animated", "rigged", "pbr"])
categoriesNoFilter by categories (e.g., ["characters", "architecture", "vehicles"])
downloadableNoSet to true to show only downloadable models, false to show all models
limitNoMaximum number of results to return (1-24, default: 10)

Implementation Reference

  • The main handler function for the 'sketchfab-search' tool. Validates inputs, checks for API key, instantiates SketchfabApiClient, performs search, formats results as text, and handles errors.
      async ({ query, tags, categories, downloadable, limit }) => {
        try {
          // Validate input
          if (!query && (!tags || tags.length === 0) && (!categories || categories.length === 0)) {
            return {
              content: [
                {
                  type: "text",
                  text: "Please provide at least one search parameter: query, tags, or categories.",
                },
              ],
            };
          }
    
          // Check if API key is available
          if (!apiKey) {
            return {
              content: [
                {
                  type: "text",
                  text: "No Sketchfab API key provided. Please provide an API key using the --api-key parameter or set the SKETCHFAB_API_KEY environment variable.",
                },
              ],
            };
          }
    
          // Create API client
          const client = new SketchfabApiClient(apiKey);
          
          // Search for models
          const searchResults = await client.searchModels({
            q: query,
            tags,
            categories,
            downloadable,
            count: limit || 10,
          });
          
          // Handle no results
          if (!searchResults.results || searchResults.results.length === 0) {
            return {
              content: [
                {
                  type: "text",
                  text: "No models found matching your search criteria. Try different keywords or filters.",
                },
              ],
            };
          }
          
          // Format results
          const formattedResults = searchResults.results
            .map((model, index) => `[${index + 1}] ${model.name}\nID: ${model.uid}\nDownloadable: ${model.isDownloadable ? "Yes" : "No"}\n`)
            .join("\n");
          
          return {
            content: [
              {
                type: "text",
                text: `Found ${searchResults.results.length} models:\n\n${formattedResults}`,
              },
            ],
          };
        } catch (error: unknown) {
          const errorMessage = error instanceof Error ? error.message : String(error);
          
          return {
            content: [
              {
                type: "text",
                text: `Error searching Sketchfab: ${errorMessage}`,
              },
            ],
          };
        }
      }
    );
  • Zod input schema defining the parameters accepted by the sketchfab-search tool.
      query: z.string().optional().describe("Text search query (e.g., \"car\", \"house\", \"character\") to find relevant models"),
      tags: z.array(z.string()).optional().describe("Filter by specific tags (e.g., [\"animated\", \"rigged\", \"pbr\"])"),
      categories: z.array(z.string()).optional().describe("Filter by categories (e.g., [\"characters\", \"architecture\", \"vehicles\"])"),
      downloadable: z.boolean().optional().describe("Set to true to show only downloadable models, false to show all models"),
      limit: z.number().optional().describe("Maximum number of results to return (1-24, default: 10)"),
    },
  • index.ts:279-282 (registration)
    The server.tool registration call for the 'sketchfab-search' tool, specifying name, description, input schema, and handler function.
    server.tool(
      "sketchfab-search",
      "Search for 3D models on Sketchfab based on keywords and filters",
      {
  • The searchModels method in SketchfabApiClient class, which performs the HTTP request to Sketchfab's search endpoint and returns model results. Called by the tool handler.
    async searchModels(options: {
      q?: string;
      tags?: string[];
      categories?: string[];
      downloadable?: boolean;
      count?: number;
    }): Promise<{
      results: SketchfabModel[];
      next?: string;
      previous?: string;
    }> {
      try {
        const { q, tags, categories, downloadable, count = 24 } = options;
        
        // Build query parameters
        const params: Record<string, any> = { type: "models" };
        
        if (q) params.q = q;
        if (tags?.length) params.tags = tags;
        if (categories?.length) params.categories = categories;
        if (downloadable !== undefined) params.downloadable = downloadable;
        if (count) params.count = Math.min(count, 24); // API limit is 24
        
        // Make API request
        const response = await axios.get(`${SketchfabApiClient.API_BASE}/search`, {
          params,
          headers: this.getAuthHeader(),
        });
        
        return {
          results: response.data.results || [],
          next: response.data.next,
          previous: response.data.previous,
        };
      } catch (error: unknown) {
        if (axios.isAxiosError(error) && error.response) {
          const status = error.response.status;
          
          if (status === 401) {
            throw new Error("Invalid Sketchfab API key");
          } else if (status === 429) {
            throw new Error("Sketchfab API rate limit exceeded. Try again later.");
          }
          throw new Error(`Sketchfab API error (${status}): ${error.message}`);
        }
        throw error instanceof Error ? error : new Error(String(error));
      }
    }
  • TypeScript interface defining the structure of a Sketchfab model object used throughout the codebase for type safety.
    interface SketchfabModel {
      uid: string;
      name: string;
      description?: string;
      viewerUrl?: string;
      thumbnails?: {
        images?: Array<{
          url: string;
          width: number;
          height: number;
        }>;
      };
      user?: {
        username: string;
        displayName?: string;
      };
      isDownloadable: boolean;
      downloadCount?: number;
      viewCount?: number;
      likeCount?: number;
      license?: string;
      createdAt?: string;
      faceCount?: number;
      vertexCount?: number;
      tags?: Array<{
        slug: string;
      }>;
      categories?: Array<{
        name: string;
        slug: string;
      }>;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool searches but doesn't describe key behaviors: whether it requires authentication, rate limits, pagination, error handling, or the format of returned results. For a search tool with zero annotation coverage, this leaves significant gaps in understanding how the tool operates beyond basic functionality.

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 a single, efficient sentence that front-loads the core purpose without unnecessary words. It directly states what the tool does and the key inputs, making it easy to understand at a glance. Every part of the sentence contributes to clarifying the tool's function.

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

Completeness2/5

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

Given the tool's complexity (5 parameters, no annotations, no output schema), the description is insufficient. It lacks details on authentication requirements, result format, error conditions, and how it differs from sibling tools. For a search operation that likely returns structured data, the absence of output schema means the description should compensate by at least hinting at return types, which it does not.

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?

The description mentions 'keywords and filters,' which loosely maps to parameters like 'query,' 'tags,' and 'categories.' However, with 100% schema description coverage, the schema already fully documents all 5 parameters. The description adds minimal value beyond what's in the schema, such as clarifying the tool's focus on 3D models, but doesn't provide additional semantic context or usage examples for parameters.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Search for 3D models on Sketchfab based on keywords and filters.' It specifies the verb ('Search'), resource ('3D models on Sketchfab'), and scope ('based on keywords and filters'). However, it doesn't explicitly differentiate from sibling tools like 'sketchfab-model-details' or 'sketchfab-download,' which would require more specific boundary definitions.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'sketchfab-download' or 'sketchfab-model-details,' nor does it specify prerequisites, such as whether authentication is required or if this is the primary search entry point. Usage is implied but not explicitly defined.

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/gregkop/sketchfab-mcp-server'

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