generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Milestone
Description
I am currently testing the creation of an agent. I am trying to return a list of products to my agent, the type definition for my product is:
interface Product {
id: string;
name: string;
price: number;
stock: number;
}
When I create a tool that returns a set of products:
const viewCatalog = tool({
name: 'view_catalog',
description: 'Shows all available products in the catalog',
inputSchema: z.object({ category: z.string() }),
callback: () => {
const products = database.products;
return { products, totalProducts: products.length };
}
});
TS is not happy at all. Because is considers Product is not compatible with JSONValue. What I needed to do to fix this:
- Change interface to type
- OR, add [key: string]: any; to my Interface
Metadata
Metadata
Assignees
Labels
No labels