import { z } from "zod";

agent.addTool({
	name: "get_document_info",
	description: "Get information about a document",
	execute: async ({ id }) => {...}, // tool logic goes here
	parameters: z.object({
		id: z.string().describe("The document ID to get information about")
	})
});

Allows you to equip your agents with custom functions as tools that the agent can call based on context. What are tools

Arguments

Takes on argument passed as an object with the following properties:

name
string
required

The name of tool. it has to be unique in the agent’s scope.

description
string

Describe briefly what the tool does and when the agent should call it in natural language. make the description clear so the agent understands when to call the tool.

schema
Zod Schema
required

A Zod schema that defines the parameters. It is converted to a JSON schema that is passed to the LLM, and used to validate the LLM tool calls.

Recommended resources:

How to build my tools

execute
Function
required

The function that will be executed when the agent calls this tool. it will be passed validated type-safe inputs based on the provided zod schema.

Behaviour

If you add more than 5 tools to an agent Scoopika will select the top 5 most relevant tools for each run based on the inputs.

import { z } from "zod";

agent.addTool({
	name: "get_document_info",
	description: "Get information about a document",
	execute: async ({ id }) => {...}, // tool logic goes here
	parameters: z.object({
		id: z.string().describe("The document ID to get information about")
	})
});