0.1.0-dev • Published 6 months ago

@optimizely-opal/opal-tools-sdk v0.1.0-dev

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Opal Tools SDK for TypeScript

This SDK simplifies the creation of tools services compatible with the Opal Tools Management Service.

Features

  • Type definitions for tools and parameters
  • Express middleware for discovery endpoints
  • Decorators for tool registration
  • Parameter validation
  • Authentication helpers

Installation

npm install @optimizely-opal/opal-tools-sdk

Usage

import { ToolsService, tool } from '@optimizely-opal/opal-tools-sdk';
import express from 'express';

interface WeatherParameters {
  location: string;
  units?: string;
}

const app = express();
const toolsService = new ToolsService(app);

@tool({
  name: 'get_weather',
  description: 'Gets current weather for a location'
})
async function getWeather(parameters: WeatherParameters) {
  // Implementation...
  return { temperature: 22, condition: 'sunny' };
}

// Discovery endpoint is automatically created at /discovery
app.listen(3000);

Documentation

See full documentation for more examples and configuration options.

0.1.0-dev

6 months ago