sketchfab-model-details
Retrieve comprehensive details for any Sketchfab 3D model using its unique ID, including specifications, creator information, and download options.
Instructions
Get detailed information about a specific Sketchfab model
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| modelId | Yes | The unique ID of the Sketchfab model (found in URLs or search results) |
Implementation Reference
- index.ts:374-417 (handler)The main handler function that implements the tool logic: checks for API key, instantiates SketchfabApiClient, calls getModel on the modelId, formats the result using formatModelForDisplay, and returns markdown-formatted text content or error message.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}`, }, ], }; } }
- index.ts:371-373 (schema)Input schema using Zod, defining the required 'modelId' parameter as a string.{ modelId: z.string().describe("The unique ID of the Sketchfab model (found in URLs or search results)"), },
- index.ts:368-370 (registration)Tool registration via server.tool() with the tool name 'sketchfab-model-details' and description.server.tool( "sketchfab-model-details", "Get detailed information about a specific Sketchfab model",
- index.ts:240-253 (helper)Utility function that formats a SketchfabModel object into a human-readable string used in the tool's output.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}` : ""} `; }
- index.ts:133-155 (helper)SketchfabApiClient method that performs the core API call to retrieve model details by UID, with error handling for not found, auth, etc.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)); } }