---
layout: default
---
# Tools: Definiendo Herramientas
```typescript
import { tool } from "@langchain/core/tools";
import { z } from "zod";
const weatherTool = tool(
async ({ location }) => {
// Llamar a API del tiempo
return `El tiempo en ${location} es soleado, 22°C`;
},
{
name: "get_weather",
description: "Obtiene el tiempo actual de una ubicación",
schema: z.object({
location: z.string().describe("Ciudad o ubicación"),
}),
}
);
```
```typescript
// El agente decide automáticamente cuándo usar cada tool
const agent = createAgent({
model: "mistral:mistral-large-latest",
tools: [weatherTool, calculatorTool, searchTool],
});
```