Skip to content

Create Custom Tools with SDKs

⏱ 30 minutes advanced
πŸ“œAdvancedOpal

System tools handle common tasks. Connector tools integrate popular third-party platforms. But every organization has unique needs: proprietary CRM systems, internal analytics dashboards, custom pricing engines, or legacy databases that no pre-built tool covers. Custom tools bridge these gaps by letting your developers expose any HTTP endpoint as an Opal capability.

A JSON declaration describing the tool to Opal. It includes:

  • Name and description: Human-readable labels
  • Parameters: Input specifications with name, data type (string, number, boolean, array, or object), description, and required status
  • Execution details: HTTP endpoint URL and method (GET or POST)
  • Authentication requirements: Credential specifications

An HTTP endpoint (typically /discovery) that returns tool manifests. When you register a custom tool, Opal calls this endpoint to discover available tools. If the endpoint is inaccessible or returns malformed data, Opal cannot find or use the tools.

Opal supports only Opti ID for tool authentication. Common patterns include bearer tokens in Authorization headers and OAuth flows for third-party service integrations.

SDKInstall commandBest for
JavaScript/TypeScriptnpm install @optimizely-opal/opal-tools-sdkWeb-based tools, Node.js workflows, UI extensions
Pythonpip install optimizely-opal.opal-tools-sdkBackend automation, data processing, ML pipelines
C#Install-Package OptimizelyOpal.OpalToolsSDKEnterprise .NET applications, Azure integrations
  • Team expertise: Use technologies your team already knows
  • Performance: C# for low-latency, Python for data-heavy, JavaScript for concurrent I/O
  • Tool type: Python for data/ML, JavaScript for web APIs, C# for enterprise backends
  • Ecosystem: C# for Microsoft/Azure, Python for cloud/data, JavaScript for web APIs
  • Deployment: All SDKs support serverless (AWS Lambda, Azure Functions, Google Cloud Functions) and containers (Kubernetes, OCP)
  • Type definitions for parameters and responses
  • Express.js middleware for rapid API setup
  • @tool() decorators for clean tool definitions
  • Built-in parameter validation
  • Authentication helpers for Opti ID
  • @tool() decorators for Pythonic tool definitions
  • Automatic /discovery endpoint generation
  • Python type hint validation
  • FastAPI integration (Python 3.7+)
  • Authentication helpers
  • [Tool] and [RequiresAuth] attributes for declarative configuration
  • ASP.NET Core integration
  • Advanced parameter validation with data annotations
  • Dependency injection support for enterprise patterns

After building your tool:

  1. Deploy it to an accessible HTTP endpoint
  2. Navigate to Opal > Tools
  3. Click Add Custom Tool
  4. Enter the discovery endpoint URL
  5. Opal calls the endpoint and displays discovered tools
  6. Review tool descriptions and parameters
  7. Click Add to register the tools
  8. Toggle Active and optionally Enabled in Chat
  • Avoid hardcoding sensitive information in tool manifests. Use environment variables and configuration management.
  • Return structured JSON from tool execution endpoints for reliable parsing by Opal.
  • Handle errors gracefully with descriptive error messages that help Opal explain failures to users.
  • Version your tools to maintain backward compatibility when updating endpoints.
  • Test discovery endpoints independently before registering in Opal.