Skip to content

Your first tool

Tools give a model a schema, a description, and a server-side implementation. They run inside the deployed workspace, so keep provider credentials in the platform configuration or runtime environment rather than in browser code.

Open Compute → Tools, create a tool, and use this source.

first-tool.ts
import type { Tool } from "@neutrome/lilsdk";
const weather: Tool = {
name: "weather",
description: "Get the current weather for a city.",
schema: {
type: "object",
properties: {
city: { type: "string", description: "City name" },
},
required: ["city"],
additionalProperties: false,
},
systemPromptFragment: "Use weather when the user asks about current weather.",
async execute(args) {
const city = String(args.city);
return `Weather data for ${city} is not configured yet.`;
},
};
export default weather;

Use precise description, schema, and systemPromptFragment values. They are the instructions the model receives when the tool is attached.

Select the model or models that should receive the tool, save, then deploy the workspace. The deployment generator creates the createToolsExecutor() wrapper for those attachments. Do not wrap the model source a second time.

Tool editor with attached model selector

Ask the model a question that needs the tool. The model chooses whether to call it from the published schema. Tool results return as text to the model before it produces the final answer.