Skip to main content
Glama
netlify

Netlify MCP Server

Official
by netlify

netlify-team-services-reader

Retrieve team information from Netlify services to manage access and resources. Use this tool to get team details or list all teams in your account.

Instructions

Select and run one of the following Netlify read operations (read-only) get-teams, get-team

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectSchemaYes

Implementation Reference

  • Registers the 'netlify-team-services-reader' tool when processing team domain read tools. Defines the selector schema, tool name, and dispatching handler that calls the appropriate subtool callback.
    } else { // Register tools grouped by domain with selector (uses anyOf/union) const paramsSchema = { // @ts-ignore selectSchema: tools.length > 1 ? z.union(tools.map(tool => toSelectorSchema(tool))) : toSelectorSchema(tools[0]) }; 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) => { 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) }] } }); }
  • Defines the selector schema used for grouped tools like netlify-team-services-reader, including operation and optional params from subtool schemas.
    const toSelectorSchema = (domainTool: DomainTool<any>) => { return z.object({ // domain: z.literal(domainTool.domain), operation: z.literal(domainTool.operation), params: domainTool.inputSchema.optional(), llmModelName: z.string().optional(), aiAgentName: z.string().optional() }); }
  • Subtool handler for 'get-teams' operation: fetches teams from Netlify API and enriches data for LLM.
    export const getTeamsDomainTool: DomainTool<typeof getTeamsParamsSchema> = { domain: 'team', operation: 'get-teams', inputSchema: getTeamsParamsSchema, toolAnnotations: { readOnlyHint: true, }, cb: async (_, {request}) => { return JSON.stringify(getEnrichedTeamModelForLLM(await getAPIJSONResult('/api/v1/accounts', {}, {}, request))); } }
  • Subtool handler for 'get-team' operation: fetches specific team by ID from Netlify API and enriches data for LLM.
    export const getTeamDomainTool: DomainTool<typeof getTeamParamsSchema> = { domain: 'team', operation: 'get-team', inputSchema: getTeamParamsSchema, toolAnnotations: { readOnlyHint: true, }, cb: async ({ teamId }, {request}) => { return JSON.stringify(getEnrichedTeamModelForLLM(await getAPIJSONResult(`/api/v1/accounts/${teamId}`, {}, {}, request))); } }
  • Helper function to enrich raw team data from API with additional LLM-friendly fields.
    export function getEnrichedTeamModelForLLM(teams: any[] | any) { if (!teams) { return []; } return (Array.isArray(teams) ? teams : [teams]).map((team: any) => { const fieldsToMap = ['id', 'name', 'slug', 'created_at', 'updated_at', 'members_count', 'enforce_mfa', 'type_name']; return ({ ...Object.fromEntries(Object.entries(team).filter(([key]) => fieldsToMap.includes(key))), _enrichedFields: { currentUserRoleOnTeam: team.role, netlifyUrlForTeam: `https://app.netlify.com/teams/${team.slug}` } }); }); }

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/netlify/netlify-mcp'

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