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,
        },
      },
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('List') but doesn't mention whether this is a read-only operation, if it requires authentication, what the output format looks like, or any rate limits. For a listing tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized for a simple listing operation and front-loads the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a listing tool with three well-documented parameters but no annotations or output schema, the description is minimally complete. It identifies the resource but doesn't address behavioral aspects like pagination behavior, authentication needs, or output format, which could help the agent understand what to expect.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, thoroughly documenting all three parameters with their purposes, enums, defaults, and constraints. The description adds no additional parameter information beyond what the schema already provides, which is adequate but not additive.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('Netlify sites'), making the purpose immediately understandable. However, it doesn't distinguish this tool from its siblings like 'getSite', which might retrieve a specific site rather than listing multiple sites.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'getSite' or 'createSiteFromGitHub'. There's no mention of prerequisites, typical use cases, or comparisons to sibling tools, leaving the agent without contextual usage cues.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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