getDeploymentEvents
Retrieve deployment events by deployment ID and build ID, filter by name, status code, or timestamp, and specify retrieval direction or limit for precise tracking and analysis.
Instructions
Gets deployment events by deployment ID and build ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| builds | No | Builds parameter | |
| delimiter | No | Delimiter for events | |
| deploymentId | Yes | The ID or URL of the deployment | |
| direction | No | Direction of events retrieval | |
| follow | No | Follow parameter for events | |
| limit | No | Limit on number of events to return | |
| name | No | Filter events by name | |
| since | No | Timestamp to get events from | |
| slug | No | Slug | |
| statusCode | No | Filter events by status code | |
| teamId | No | Team ID | |
| until | No | Timestamp to get events until |
Implementation Reference
- src/vercel/deployments.ts:11-62 (handler)Core implementation of getDeploymentEvents: fetches deployment events from Vercel API using fetch with constructed query parameters.export async function getDeploymentEvents( env: Env, deploymentId: string, options?: { direction?: "forward" | "backward" limit?: number name?: string since?: number until?: number statusCode?: string delimiter?: number builds?: number teamId?: string slug?: string } ) { // Construct the URL for the Vercel API endpoint let url = `https://api.vercel.com/v3/deployments/${deploymentId}/events` // Create the query parameters const params = new URLSearchParams() params.append("follow", "0") // Always set follow=0 as requested // Add other optional parameters if (options?.direction) params.append("direction", options.direction) if (options?.limit) params.append("limit", options.limit.toString()) if (options?.name) params.append("name", options.name) if (options?.since) params.append("since", options.since.toString()) if (options?.until) params.append("until", options.until.toString()) if (options?.statusCode) params.append("statusCode", options.statusCode) if (options?.delimiter) params.append("delimiter", options.delimiter.toString()) if (options?.builds) params.append("builds", options.builds.toString()) if (options?.teamId) params.append("teamId", options.teamId) if (options?.slug) params.append("slug", options.slug) // Append the query parameters to the URL url = `${url}?${params.toString()}` // Make the fetch request const response = await fetch(url, { headers: { Authorization: `Bearer ${env.VERCEL_API_TOKEN}`, "Content-Type": "application/json" } }) // Parse the response as JSON const data = await response.json() return MCPResponse(data) }
- src/index.ts:45-97 (registration)MCP server tool registration for 'getDeploymentEvents', including input schema with Zod validation and wrapper handler that calls the core function.server.tool( "getDeploymentEvents", "Gets deployment events by deployment ID and build ID", { deploymentId: z.string().describe("The ID or URL of the deployment"), direction: z .enum(["forward", "backward"]) .optional() .describe("Direction of events retrieval"), follow: z.number().optional().describe("Follow parameter for events"), limit: z .number() .optional() .describe("Limit on number of events to return"), name: z.string().optional().describe("Filter events by name"), since: z.number().optional().describe("Timestamp to get events from"), until: z.number().optional().describe("Timestamp to get events until"), statusCode: z .string() .optional() .describe("Filter events by status code"), delimiter: z.number().optional().describe("Delimiter for events"), builds: z.number().optional().describe("Builds parameter"), teamId: z.string().optional().describe("Team ID"), slug: z.string().optional().describe("Slug") }, async ({ deploymentId, ...options }) => { try { const env = { VERCEL_API_TOKEN: apiKey } const result = await getDeploymentEvents(env, deploymentId, options) return { content: [ { type: "text", text: JSON.stringify(result, null, 2) } ] } } catch (error: unknown) { console.error("Error getting deployment events:", error) const errorMessage = error instanceof Error ? error.message : String(error) return { content: [ { type: "text", text: `Error getting deployment events: ${errorMessage}` } ] } } } )
- src/index.ts:49-70 (schema)Input schema for getDeploymentEvents tool using Zod for parameter validation.deploymentId: z.string().describe("The ID or URL of the deployment"), direction: z .enum(["forward", "backward"]) .optional() .describe("Direction of events retrieval"), follow: z.number().optional().describe("Follow parameter for events"), limit: z .number() .optional() .describe("Limit on number of events to return"), name: z.string().optional().describe("Filter events by name"), since: z.number().optional().describe("Timestamp to get events from"), until: z.number().optional().describe("Timestamp to get events until"), statusCode: z .string() .optional() .describe("Filter events by status code"), delimiter: z.number().optional().describe("Delimiter for events"), builds: z.number().optional().describe("Builds parameter"), teamId: z.string().optional().describe("Team ID"), slug: z.string().optional().describe("Slug") },