getSite
Retrieve detailed information about a Netlify site by providing its unique site ID using this tool, part of the Netlify MCP Server for site management.
Instructions
Get details of a specific site
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| siteId | Yes | ID of the site to retrieve |
Implementation Reference
- src/index.ts:318-354 (handler)Handler function for the 'getSite' tool. Validates input, fetches site details from Netlify API using axios, handles errors including 404, and returns formatted JSON 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, requiring a siteId string.interface GetSiteArgs { siteId: string; }
- src/index.ts:167-180 (registration)Tool registration in the ListTools response, specifying name, description, and input schema matching the GetSiteArgs interface.{ 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'], }, },