Import
TypeScript
import { createContext7ToolSource, createProjectScopedRemoteToolCatalog, dynamicTool, loadRemoteToolsFromSource, tool, toolRegistry,} from "veryfront/tool";Examples
Basic tool
TypeScript
import { tool } from "veryfront/tool";import { defineSchema } from "veryfront/schemas"; const convertLength = tool({ id: "convert_length", description: "Convert meters to feet", inputSchema: defineSchema((v) => v.object({ meters: v.number().nonnegative().describe("Length in meters"), }) )(), execute: ({ meters }) => { return { feet: meters * 3.28084 }; },});Use with an agent
TypeScript
import { agent } from "veryfront/agent";import { tool } from "veryfront/tool";import { defineSchema } from "veryfront/schemas"; const convertLength = tool({ id: "convert_length", description: "Convert meters to feet", inputSchema: defineSchema((v) => v.object({ meters: v.number().nonnegative().describe("Length in meters"), }) )(), execute: ({ meters }) => { return { feet: meters * 3.28084 }; },}); const assistant = agent({ system: "You answer unit-conversion questions.", tools: { convert_length: convertLength }, maxSteps: 5,});Load remote tools for an agent
TypeScript
import { agent } from "veryfront/agent";import { createRemoteMCPToolSource, loadRemoteToolsFromSource } from "veryfront/tool"; const docsTools = createRemoteMCPToolSource({ id: "docs-mcp", endpoint: "https://docs.example.com/mcp", headers: { Authorization: "Bearer <TOKEN>" },}); const runtimeTools = await loadRemoteToolsFromSource(docsTools, { context: { projectId: "proj_123" }, toolNameAliases: { search_docs: "docs_search" },}); const assistant = agent({ system: "Use the docs tools when a question needs project documentation.", tools: runtimeTools, maxSteps: 5,}); const result = await assistant.generate({ input: "Find the deployment guide for this project.",});API
tool(config)
Create a typed tool definition.
Returns: <code>Tool<TInput, TOutput></code>