discover_environment
Identify available corporations and sites for authenticated users, enabling exploration of specific environments within the Fastly NGWAF MCP Server.
Instructions
Discover available corporations and sites for the authenticated user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| corpName | No | Specific corporation to explore (optional) |
Implementation Reference
- server.js:886-896 (handler)The core handler logic for the 'discover_environment' tool within the CallToolRequestSchema handler's switch statement. It checks if corpName is provided; if yes, lists sites for that corp using client.listSites(); otherwise, lists all accessible corporations using client.listCorps().case 'discover_environment': if (typedArgs.corpName) { const { corpName } = resolveContext(typedArgs); const sites = await client.listSites(corpName); result = { corporation: corpName, sites }; } else { const corps = await client.listCorps(); result = { corporations: corps }; } break;
- server.js:440-445 (schema)Input schema definition for the 'discover_environment' tool, specifying an optional corpName parameter.inputSchema: { type: 'object', properties: { corpName: { type: 'string', description: 'Specific corporation to explore (optional)' }, }, },
- server.js:438-446 (registration)Tool registration object added to the 'tools' array, which is returned by the ListToolsRequestSchema handler, declaring the tool's name, description, and input schema.name: 'discover_environment', description: 'Discover available corporations and sites for the authenticated user', inputSchema: { type: 'object', properties: { corpName: { type: 'string', description: 'Specific corporation to explore (optional)' }, }, }, },
- server.js:387-394 (helper)Helper function 'resolveContext' used in the handler to derive corpName from arguments or global context.function resolveContext(args) { const corpName = args.corpName || context.defaultCorpName; const siteName = args.siteName || context.defaultSiteName; if (!corpName) { throw new Error('Corporation name is required. Please set context or provide corpName parameter.'); } return { corpName, siteName }; }
- server.js:50-53 (helper)FastlyNGWAFClient.listCorps() method invoked by the handler to fetch list of corporations when no specific corpName is provided.async listCorps() { const response = await this.api.get('/corps'); return response.data; }