Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,9 @@ if (await client.isServerHealthy("time")) {

Generate (cached) callable functions that work directly with AI agent frameworks. No conversion layers needed.

> [!IMPORTANT]
> If you want to get agent tools mutiple times using different filter options, you need to call `client.clearAgentToolsCache()` to force regeneration.
> [!IMPORTANT]
> Generated functions are cached for performance. Once cached, subsequent calls return cached functions regardless of filter parameters.
> To force regeneration, either call `client.clearAgentToolsCache()` first, or use the `refreshCache: true` option.

##### Supports filtering by servers and by tools

Expand All @@ -474,8 +475,8 @@ This prevents overwhelming the model's context window and improves response qual
##### Examples

```typescript
// Options: { servers?: string[], tools?: string[], format?: 'array' | 'object' | 'map' }
// Default format is 'array' (for LangChain)
// Options: { servers?: string[], tools?: string[], format?: 'array' | 'object' | 'map', refreshCache?: boolean }
// Default format is 'array' (for LangChain), refreshCache defaults to false
```

LangChain
Expand Down Expand Up @@ -553,18 +554,15 @@ const toolsObject = await client.getAgentTools({
format: "object",
});

// Clear cached generated functions before recreating
client.clearAgentToolsCache();

// Use with Map for efficient lookups
const toolMap = await client.getAgentTools({ format: "map" });
const timeTool = toolMap.get("time__get_current_time");
if (timeTool) {
const result = await timeTool({ timezone: "UTC" });
}

// Clear cached generated functions before recreating
client.clearAgentToolsCache();
// Force refresh from cache to get latest schemas
const freshTools = await client.getAgentTools({ refreshCache: true });

// Each function has metadata for both frameworks
const tools = await client.getAgentTools();
Expand Down
Loading