Skip to main content
Glama

listSites

Retrieve and manage your Netlify sites by listing them with filters for access type and pagination controls.

Instructions

List Netlify sites

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNoFilter sites by access typeall
pageNoPage number for pagination
perPageNoNumber of sites per page (max 100)

Implementation Reference

  • Handler for the 'listSites' tool. Parses arguments, constructs query parameters for filtering and pagination, fetches sites from Netlify API, formats the response, and returns JSON with site details.
    case 'listSites': { const args = request.params.arguments as unknown as ListSitesArgs; try { const params: any = {}; if (args?.filter && args.filter !== 'all') { params.filter = args.filter; } if (args?.page) { params.page = args.page; } if (args?.perPage) { params.per_page = Math.min(args.perPage, 100); } const response = await this.axiosInstance.get('/sites', { params }); const sites = response.data.map((site: any) => ({ id: site.id, name: site.name, url: site.url, admin_url: site.admin_url, created_at: site.created_at, updated_at: site.updated_at, published_deploy: site.published_deploy ? { id: site.published_deploy.id, created_at: site.published_deploy.created_at, } : null, })); return { content: [ { type: 'text', text: JSON.stringify({ success: true, sites, count: sites.length, }, null, 2), }, ], }; } catch (error) { if (axios.isAxiosError(error)) { throw new McpError( ErrorCode.InternalError, `Failed to list sites: ${this.formatNetlifyError(error)}` ); } throw error; } }
  • src/index.ts:142-166 (registration)
    Registers the 'listSites' tool in the ListTools response, including name, description, and input schema.
    { name: 'listSites', description: 'List Netlify sites', inputSchema: { type: 'object', properties: { filter: { type: 'string', enum: ['all', 'owner', 'guest'], description: 'Filter sites by access type', default: 'all', }, page: { type: 'number', description: 'Page number for pagination', default: 1, }, perPage: { type: 'number', description: 'Number of sites per page (max 100)', default: 20, }, }, }, },
  • TypeScript interface defining the input arguments for the listSites tool.
    interface ListSitesArgs { filter?: 'all' | 'owner' | 'guest'; page?: number; perPage?: number; }
  • JSON schema for input validation of the listSites tool.
    inputSchema: { type: 'object', properties: { filter: { type: 'string', enum: ['all', 'owner', 'guest'], description: 'Filter sites by access type', default: 'all', }, page: { type: 'number', description: 'Page number for pagination', default: 1, }, perPage: { type: 'number', description: 'Number of sites per page (max 100)', default: 20, }, }, },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MCERQUA/netlify-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server