getDeploymentFileContents
Retrieve contents of specific files within a deployment by providing deployment and file IDs, enabling direct access to essential data for management and troubleshooting.
Instructions
Gets deployment file contents
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deploymentId | Yes | The ID of the deployment | |
| fileId | Yes | The ID of the file | |
| slug | No | Slug | |
| teamId | No | Team ID |
Implementation Reference
- src/index.ts:211-251 (registration)Registration of the 'getDeploymentFileContents' MCP tool, including description, input schema, and handler function.server.tool( "getDeploymentFileContents", "Gets deployment file contents", { deploymentId: z.string().describe("The ID of the deployment"), fileId: z.string().describe("The ID of the file"), teamId: z.string().optional().describe("Team ID"), slug: z.string().optional().describe("Slug") }, async ({ deploymentId, fileId, ...options }) => { try { const env = { VERCEL_API_TOKEN: apiKey } const result = await getDeploymentFileContents( env, deploymentId, fileId, options ) return { content: [ { type: "text", text: JSON.stringify(result, null, 2) } ] } } catch (error: unknown) { console.error("Error getting deployment file contents:", error) const errorMessage = error instanceof Error ? error.message : String(error) return { content: [ { type: "text", text: `Error getting deployment file contents: ${errorMessage}` } ] } } } )
- src/index.ts:220-250 (handler)The handler function for the tool that prepares the environment, calls the helper function, and returns the result as MCP content or handles errors.async ({ deploymentId, fileId, ...options }) => { try { const env = { VERCEL_API_TOKEN: apiKey } const result = await getDeploymentFileContents( env, deploymentId, fileId, options ) return { content: [ { type: "text", text: JSON.stringify(result, null, 2) } ] } } catch (error: unknown) { console.error("Error getting deployment file contents:", error) const errorMessage = error instanceof Error ? error.message : String(error) return { content: [ { type: "text", text: `Error getting deployment file contents: ${errorMessage}` } ] } } }
- src/index.ts:214-219 (schema)Zod schema defining the input parameters for the getDeploymentFileContents tool.{ deploymentId: z.string().describe("The ID of the deployment"), fileId: z.string().describe("The ID of the file"), teamId: z.string().optional().describe("Team ID"), slug: z.string().optional().describe("Slug") },
- src/vercel/deployments.ts:154-174 (helper)Helper function that creates Vercel SDK client and calls getDeploymentFileContents to fetch the file contents, wrapping in MCPResponse.export async function getDeploymentFileContents( env: Env, deploymentId: string, fileId: string, options?: { teamId?: string slug?: string } ) { const vercel = new Vercel({ bearerToken: env.VERCEL_API_TOKEN }) const response = await vercel.deployments.getDeploymentFileContents({ id: deploymentId, fileId: fileId, ...options }) return MCPResponse(response) }