get_download_url
Retrieve the download URL for a specific AI model version by providing its ID, enabling direct access to the model file on Civitai's platform via the MCP server.
Instructions
Get the download URL for a specific model version
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| modelVersionId | Yes | The ID of the model version to get download URL for |
Implementation Reference
- src/index.ts:668-682 (handler)The primary handler function for the 'get_download_url' MCP tool. It extracts the modelVersionId from arguments, retrieves the download URL via the CivitaiClient, and returns a formatted text response with the URL and download instructions.private async getDownloadUrl(args: any) { const { modelVersionId } = args; const downloadUrl = this.client.getDownloadUrl(modelVersionId); return { content: [ { type: 'text', text: `Download URL for model version ${modelVersionId}:\\n\\n${downloadUrl}\\n\\n` + `**Note:** Use \`wget "${downloadUrl}" --content-disposition\` to download with proper filename.\\n` + `If the model requires authentication, add your API key: \`?token=YOUR_API_KEY\``, }, ], }; }
- src/index.ts:313-323 (registration)The tool registration entry in the getTools() method, defining the name 'get_download_url', description, and input schema (requiring modelVersionId as number).{ name: 'get_download_url', description: 'Get the download URL for a specific model version', inputSchema: { type: 'object', properties: { modelVersionId: { type: 'number', description: 'The ID of the model version to get download URL for' }, }, required: ['modelVersionId'], }, },
- src/index.ts:316-322 (schema)The input schema for the get_download_url tool, specifying an object with required 'modelVersionId' property of type number.inputSchema: { type: 'object', properties: { modelVersionId: { type: 'number', description: 'The ID of the model version to get download URL for' }, }, required: ['modelVersionId'], },
- src/civitai-client.ts:155-157 (helper)Supporting helper method in CivitaiClient that generates the actual download URL by calling buildUrl with the model version endpoint.getDownloadUrl(modelVersionId: number): string { return this.buildUrl(`/download/models/${modelVersionId}`); }