Skip to main content
Glama
gregkop
by gregkop

sketchfab-model-details

Retrieve comprehensive details about any Sketchfab 3D model by entering its unique model ID. Streamlines access to essential information directly from the Sketchfab platform.

Instructions

Get detailed information about a specific Sketchfab model

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelIdYesThe unique ID of the Sketchfab model (found in URLs or search results)

Implementation Reference

  • The handler function for the 'sketchfab-model-details' tool. It validates the API key, fetches the model details using SketchfabApiClient.getModel(modelId), formats the output using formatModelForDisplay, and returns the result as text content or handles errors.
    async ({ modelId }) => { try { // 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); // Get model details const model = await client.getModel(modelId); // Format model details const formattedModel = formatModelForDisplay(model); return { content: [ { type: "text", text: formattedModel, }, ], }; } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: "text", text: `Error getting model details: ${errorMessage}`, }, ], }; } }
  • The input schema for the tool, defining the required 'modelId' parameter using Zod.
    { modelId: z.string().describe("The unique ID of the Sketchfab model (found in URLs or search results)"), },
  • index.ts:368-418 (registration)
    The registration of the 'sketchfab-model-details' tool using server.tool(), including name, description, input schema, and handler reference.
    server.tool( "sketchfab-model-details", "Get detailed information about a specific Sketchfab model", { modelId: z.string().describe("The unique ID of the Sketchfab model (found in URLs or search results)"), }, async ({ modelId }) => { try { // 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); // Get model details const model = await client.getModel(modelId); // Format model details const formattedModel = formatModelForDisplay(model); return { content: [ { type: "text", text: formattedModel, }, ], }; } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: "text", text: `Error getting model details: ${errorMessage}`, }, ], }; } } );
  • Helper function used by the handler to format the Sketchfab model data into a readable string.
    function formatModelForDisplay(model: SketchfabModel): string { const thumbnailUrl = model.thumbnails?.images?.[0]?.url || "No thumbnail"; const username = model.user?.username || "Unknown"; const downloadable = model.isDownloadable ? "Yes" : "No"; return ` [Model] ${model.name} ID: ${model.uid} Creator: ${username} Downloadable: ${downloadable} Thumbnail: ${thumbnailUrl} ${model.description ? `Description: ${model.description}` : ""} `; }
  • The SketchfabApiClient.getModel method called by the handler to fetch detailed model information from the Sketchfab API.
    async getModel(uid: string): Promise<SketchfabModel> { try { const response = await axios.get( `${SketchfabApiClient.API_BASE}/models/${uid}`, { headers: this.getAuthHeader(), } ); return response.data; } catch (error: unknown) { if (axios.isAxiosError(error) && error.response) { const status = error.response.status; if (status === 404) { throw new Error(`Model with UID ${uid} not found`); } else if (status === 401) { throw new Error("Invalid Sketchfab API key"); } throw new Error(`Sketchfab API error (${status}): ${error.message}`); } throw error instanceof Error ? error : new Error(String(error)); } }

Other Tools

Related 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