netlify-deploy-services-reader
Retrieve detailed information about Netlify deployments by providing a deploy ID or site ID to access deployment status and configuration data.
Instructions
Select and run one of the following Netlify read operations (read-only) get-deploy, get-deploy-for-site
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selectSchema | Yes |
Implementation Reference
- src/tools/index.ts:144-154 (registration)Registers the 'netlify-deploy-services-reader' tool for the deploy domain read operations (get-deploy, get-deploy-for-site). The toolName is constructed as netlify-deploy-services-reader.const friendlyOperationType = operationType === 'read' ? 'reader' : 'updater'; const toolName = `netlify-${domain}-services-${friendlyOperationType}`; const toolDescription = `Select and run one of the following Netlify ${operationType} operations${readOnlyIndicator} ${toolOperations.join(', ')}`; server.registerTool(toolName, { description: toolDescription, inputSchema: paramsSchema, annotations: { readOnlyHint: operationType === 'read' } }, async (...args) => {
- src/tools/index.ts:154-197 (handler)The main handler function for the 'netlify-deploy-services-reader' tool. It authenticates, parses the input to select the sub-operation (get-deploy or get-deploy-for-site), executes the corresponding subtool callback, and returns the JSON result.}, async (...args) => { checkCompatibility(); try { await getNetlifyAccessToken(remoteMCPRequest); } catch (error: NetlifyUnauthError | any) { if (error instanceof NetlifyUnauthError && remoteMCPRequest) { throw new NetlifyUnauthError(); } return { content: [{ type: "text", text: error?.message || 'Failed to get Netlify token' }], isError: true }; } appendToLog(`${toolName} operation: ${JSON.stringify(args)}`); const selectedSchema = args[0]?.selectSchema as any; if (!selectedSchema) { return { content: [{ type: "text", text: 'Failed to select a valid operation. Retry the MCP operation but select the operation and provide the right inputs.' }] } } const operation = selectedSchema.operation; const subtool = tools.find(subtool => subtool.operation === operation); if (!subtool) { return { content: [{ type: "text", text: 'Agent called the wrong MCP tool for this operation.' }] } } const result = await subtool.cb(selectedSchema.params || {}, {request: remoteMCPRequest, isRemoteMCP: !!remoteMCPRequest}); appendToLog(`${domain} operation result: ${JSON.stringify(result)}`); return { content: [{ type: "text", text: JSON.stringify(result) }] } });
- src/tools/index.ts:139-142 (schema)Input schema definition for the grouped reader tool, using a union of selector schemas for each deploy read operation.const paramsSchema = { // @ts-ignore selectSchema: tools.length > 1 ? z.union(tools.map(tool => toSelectorSchema(tool))) : toSelectorSchema(tools[0]) };
- Sub-tool helper: 'get-deploy' operation fetches details of a specific deploy by its ID using the Netlify API.export const getDeployByIdDomainTool: DomainTool<typeof getDeployByIdParamsSchema> = { domain: 'deploy', operation: 'get-deploy', inputSchema: getDeployByIdParamsSchema, toolAnnotations: { readOnlyHint: true, }, cb: async (params, {request}) => { const { deployId } = params; return JSON.stringify(await getAPIJSONResult(`/api/v1/deploys/${deployId}`, {}, {}, request)); } }
- Sub-tool helper: 'get-deploy-for-site' operation fetches deploy details by site ID and deploy ID using the Netlify API.export const getDeployBySiteIdDomainTool: DomainTool<typeof getDeployBySiteIdParamsSchema> = { domain: 'deploy', operation: 'get-deploy-for-site', inputSchema: getDeployBySiteIdParamsSchema, toolAnnotations: { readOnlyHint: true, }, cb: async (params, {request}) => { const { siteId, deployId } = params; return JSON.stringify(await getAPIJSONResult(`/api/v1/sites/${siteId}/deploys/${deployId}`, {}, {}, request)); } }