Overview
Theenkrypt_discover_all_tools tool discovers available tools from a specific MCP server or all servers, validates them through security guardrails, and caches the results for future use.
Tool discovery happens automatically when you use
enkrypt_list_all_servers with discover_tools=true. Use this tool to force re-discovery or troubleshoot specific servers.Tool Signature
Parameters
MCP context (automatically provided by the client)
Name of the server to discover tools for.
Noneor"null": Discovers tools for all servers- Specific name (e.g.,
"github"): Discovers tools for that server only
Return Value
Operation status:
"success" or "error"Human-readable description of the result
Dictionary or list of discovered tools (single server mode)
Dictionary of servers with their tools (all servers mode)
Where tools came from:
"config", "cache", or "discovery"List of tools blocked by security guardrails
Number of tools blocked
Usage Examples
Discover Tools for a Specific Server
Discover Tools for All Servers
Force Re-discovery
To bypass cache and force fresh discovery:enkrypt_clear_cache followed by enkrypt_discover_all_tools.
Response Structure
Single Server Discovery
All Servers Discovery
Tool Sources
Tools can come from three sources:config - Pre-configured Tools
config - Pre-configured Tools
Tools are explicitly defined in the gateway configuration file under the
tools property for the server.Advantages:- Instant availability
- No discovery overhead
- Can restrict which tools are accessible
cache - Cached Discovery
cache - Cached Discovery
Tools were previously discovered and cached. Default cache duration is 4 hours.Advantages:
- Fast retrieval
- No server connection needed
- Automatic refresh after expiration
enkrypt_get_cache_status to check cache expiration.discovery - Fresh Discovery
discovery - Fresh Discovery
Tools are dynamically discovered by connecting to the server and requesting its tool list.Advantages:
- Always up-to-date
- Discovers new tools automatically
- Validates tool availability
Security Validation
Tool Guardrails
If tool guardrails are enabled for a server, discovered tools are validated before being made available:Example: Blocked Tools
Server Validation
Before tool discovery, the server itself is validated:Example: Blocked Server
Implementation Details
Service Location
Implemented in:src/secure_mcp_gateway/services/discovery/discovery_service.py:52
Three-Phase Parallel Discovery
When discovering tools for all servers, the gateway uses an optimized three-phase approach:Phase 1: Server Validation
All servers are validated in parallel against security guardrails:Phase 2: Separation
Servers are separated into two groups:- Servers with config tools: Have pre-defined tools in configuration
- Servers needing discovery: Require dynamic tool discovery
Phase 3: Parallel Execution
Both groups are processed in parallel:- Config tools: Validated against guardrails
- Discovery tools: Discovered and validated
Caching Strategy
Discovered tools are cached using a composite key:- Cache duration: 4 hours (configurable)
- Cache invalidation: Automatic expiration or manual via
enkrypt_clear_cache - Cache types: Local (in-memory) or External (Redis/KeyDB)
Tool Annotations
Common Use Cases
Initial Server Setup
Initial Server Setup
After adding a new server to your configuration:
Verify Tool Updates
Verify Tool Updates
When a server is updated with new tools:
Troubleshoot Missing Tools
Troubleshoot Missing Tools
When expected tools aren’t showing up:
Check Security Blocks
Check Security Blocks
To see if any tools are being blocked:
Error Handling
DISCOVERY_SERVER_UNAVAILABLE
DISCOVERY_SERVER_UNAVAILABLE
DISCOVERY_FAILED
DISCOVERY_FAILED
Error: Tool discovery failedCauses:
- Server command/arguments incorrect
- Required dependencies not installed
- Server not responding
- Network connectivity issues
GUARDRAIL_VALIDATION_FAILED
GUARDRAIL_VALIDATION_FAILED
Error: Server blocked by security guardrailsCause: Server configuration violates security policiesSolution: Review server configuration and guardrail policies
Timeout Errors
Timeout Errors
Error: Discovery operation timed outCause: Server taking too long to respondSolution:
- Check server performance
- Adjust timeout settings in gateway config
- Use
enkrypt_get_timeout_metricsto diagnose
Performance Optimization
Use Cache
Don’t force re-discovery unless necessary. Cached tools are returned instantly.
Discover in Background
Use
enkrypt_list_all_servers with discover_tools=true to discover all tools at once.Pre-configure Tools
Define tools in your config file to skip discovery entirely.
External Cache
Use Redis/KeyDB for shared cache across multiple gateway instances.
Related Tools
List Servers
See all configured servers before discovery
Execute Tools
Use discovered tools securely
Cache Status
Check cache status and expiration
Clear Cache
Force re-discovery by clearing cache