getSite
Retrieve detailed information about a specific Netlify site using its ID or name for site management and monitoring.
Instructions
Get details of a specific site
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| siteId | Yes | ID or name of the site to retrieve |
Implementation Reference
- src/index.ts:318-354 (handler)Handler for the 'getSite' tool: validates input, calls Netlify API to retrieve site details by siteId, handles errors like 404, and returns formatted response.case 'getSite': { const args = request.params.arguments as unknown as GetSiteArgs; if (!args?.siteId) { throw new McpError( ErrorCode.InvalidParams, 'Missing required parameter: siteId' ); } try { const response = await this.axiosInstance.get(`/sites/${args.siteId}`); return { content: [ { type: 'text', text: JSON.stringify({ success: true, site: response.data, }, null, 2), }, ], }; } catch (error) { if (axios.isAxiosError(error)) { if (error.response?.status === 404) { throw new McpError( ErrorCode.InvalidParams, `Site not found: ${args.siteId}` ); } throw new McpError( ErrorCode.InternalError, `Failed to get site: ${this.formatNetlifyError(error)}` ); } throw error; } }
- src/index.ts:40-42 (schema)TypeScript interface defining the input arguments for the getSite tool (siteId: string).interface GetSiteArgs { siteId: string; }
- src/index.ts:167-180 (registration)Registration of the 'getSite' tool in the ListTools response, specifying name, description, and input schema.{ name: 'getSite', description: 'Get details of a specific site', inputSchema: { type: 'object', properties: { siteId: { type: 'string', description: 'ID or name of the site to retrieve', }, }, required: ['siteId'], }, },