Scalable Discovery
Search across hundreds of tools using natural language
Code Orchestration
LLMs write JavaScript to combine tools, filter data, and build workflows
Bank-Grade Security
Sandboxed execution with AST validation, resource limits, and audit logging
Direct Invocation
Optionally bypass the VM for simple single-tool calls
Quick Start
codecall:search- Find relevant toolscodecall:describe- Get detailed schemascodecall:execute- Run JavaScript orchestration planscodecall:invoke- Direct tool calls (optional)
Security Model
CodeCall implements defense-in-depth with multiple security layers:Security Levels
Choose a preset that matches your threat model:| Level | Timeout | Max Iterations | Tool Calls | Use Case |
|---|---|---|---|---|
| STRICT | 1s | 100 | 5 | Ultra-sensitive environments |
| SECURE | 3s | 1,000 | 20 | Production default |
| STANDARD | 5s | 10,000 | 50 | Internal/trusted models |
| PERMISSIVE | 30s | 100,000 | 200 | Development only |
Self-Reference Blocking
Critical Security Feature: Scripts cannot call CodeCall meta-tools from within scripts.- Recursive script execution (infinite loops)
- Sandbox escape attempts
- Privilege escalation attacks
AST Validation
Every script is parsed and validated before execution:Blocked Constructs
Blocked Constructs
eval()andFunction()constructorwithstatements- Direct property access on dangerous objects
__proto__,constructor,prototypeaccess- Async generators (resource exhaustion)
- Import/export (module system bypass)
Allowed Safe Globals
Allowed Safe Globals
callTool(name, args)- Make tool callsparallel(fns, options)- Concurrent executionMath,JSON,Array,Object,String,Number,Date- Custom globals you explicitly allow
Result-Based Error Handling
Security Design: Tool calls return results instead of throwing exceptions:- Information leakage through stack traces
- Internal system path exposure
- Exception-based control flow manipulation
Resource Limits
Timeout
Enforced execution time limit prevents infinite loops
Iterations
Loop iteration counter prevents while(true) attacks
Tool Calls
Maximum tool invocations per script execution
Tool Visibility Modes
Control which tools appear inlist_tools vs. CodeCall:
codecall_only (Recommended)
Hide all tools from list_tools, expose via CodeCall:
- list_tools: Only CodeCall meta-tools visible
- CodeCall: All tools searchable and callable
- Override: Set
visibleInListTools: trueper tool
codecall_opt_in
Tools must explicitly opt into CodeCall:
metadata_driven
Full control per tool:
Meta-Tools Reference
codecall:search
Find tools by natural language query:codecall:describe
Get detailed schemas for selected tools:- Full JSON Schema for inputs/outputs
- Description and usage notes
- Example inputs/outputs
- Type information with constraints
codecall:execute
Run a JavaScript orchestration script:codecall:invoke
Direct tool invocation without JavaScript:- No VM overhead for simple calls
- Still enforces access control
- Maintains audit logging
- Applies output sanitization
AgentScript API
Insidecodecall:execute, scripts have access to:
callTool(name, args)
parallel(functions, options)
Execute multiple operations concurrently:- Maximum 100 parallel operations
- Maximum 20 concurrent executions
- Shares tool call limit with sequential calls
Available Globals
Audit Logging
CodeCall emits detailed audit events for security monitoring:execution:start/execution:success/execution:failuresecurity:self-reference- Blocked recursive callsecurity:validation-failure- AST validation failedtool:call/tool:error- Individual tool callsresource:limit-exceeded- Hit iteration/timeout/call limits
Error Enrichment
Errors are categorized with actionable suggestions:| Category | Example | Suggestion |
|---|---|---|
syntax | Unexpected token | Check JavaScript syntax at line X |
security | eval is not allowed | Remove prohibited construct |
timeout | Execution exceeded 3s | Simplify logic or increase timeout |
tool_not_found | Unknown tool ‘foo’ | Use codecall:search to find tools |
tool_error | Tool threw error | Check tool input parameters |
runtime | Cannot read property | Debug the script logic |
Output Sanitization
All outputs are sanitized before being returned:- Circular reference detection →
[circular] - Prototype pollution prevention → removes
__proto__,constructor - Large output truncation with warnings
- Stack trace removal (configurable)
- File path scrubbing (configurable)
Configuration Reference
Best Practices
1. Use SECURE Level in Production
1. Use SECURE Level in Production
The
SECURE preset provides the right balance of functionality and safety:2. Prefer codecall_only Mode
2. Prefer codecall_only Mode
For large tool sets, hide tools from
list_tools to reduce context usage:3. Monitor Audit Events
3. Monitor Audit Events
Set up alerting for security events:
4. Use Direct Invoke for Simple Calls
4. Use Direct Invoke for Simple Calls
Avoid VM overhead for single-tool operations:
5. Include Scoping in Tool Inputs
5. Include Scoping in Tool Inputs
Always include tenant/user IDs in tool calls:
Security Checklist
1
Choose Security Level
Use
SECURE for production, STRICT for ultra-sensitive environments2
Enable Audit Logging
Subscribe to audit events and monitor for security incidents
3
Configure Output Sanitization
Ensure stack traces and file paths are removed in production
4
Review Tool Access
Use appropriate mode and metadata to control tool visibility
5
Test Security Boundaries
Verify self-reference blocking and resource limits work correctly

