effect-io-ai

Package: @effect/ai
Module: Tool

Tool.getDescription

Extracts the description from a tool’s metadata.

Returns the tool’s description if explicitly set, otherwise attempts to extract it from the parameter schema’s AST annotations.

Example

import { Tool } from "@effect/ai"

const myTool = Tool.make("example", {
  description: "This is an example tool"
})

const description = Tool.getDescription(myTool)
console.log(description) // "This is an example tool"

Signature

declare const getDescription: <Name extends string, Config extends { readonly parameters: AnyStructSchema; readonly success: Schema.Schema.Any; readonly failure: Schema.Schema.All; readonly failureMode: FailureMode; }>(tool: Tool<Name, Config>) => string | undefined

Source

Since v1.0.0