Skip to main content
Dari-executed tools are custom tools that run inside Dari’s session sandbox. Use one when the work should happen in the session workspace, such as reading generated files, transforming repository content, or wrapping a repeatable command behind a typed schema. The simplest way to add a TypeScript tool is to create tools/<name>/tool.ts. The file exports a JSON Schema input schema and a handler. dari deploy reads the module locally and uploads a manifest entry plus generated schema metadata for the tool; it does not inline the schema into dari.yml.
// tools/repo_search/tool.ts
export const description = "Search the checked-out repository for matching content.";

export const inputSchema = {
  type: "object",
  properties: {
    query: { type: "string", minLength: 1 },
  },
  required: ["query"],
  additionalProperties: false,
};

export async function handler(input: { query: string }) {
  return { matches: [`searched for ${input.query}`] };
}
The tool name is inferred from the folder name, so tools/repo_search/tool.ts becomes repo_search. Keep helper modules next to it:
tools/repo_search/
  tool.ts
  github.ts
  scoring.ts
dari deploy treats tools/repo_search/tool.ts as the repo_search tool and includes the sibling helper files in the uploaded bundle. The only optional export is outputSchema. Code-first TypeScript tools are compiled locally by the Dari CLI during deploy. Your machine or CI runner needs either tsx or a Node.js version that supports --experimental-strip-types. For Python tools, use a tool directory with a tool.yml that points to the schema file and handler:
# dari.yml
custom_tools:
  - name: summarize_file
    path: tools/summarize_file
    kind: main
# tools/summarize_file/tool.yml
name: summarize_file
description: Summarize one file.
input_schema: input.schema.json
runtime: python
handler: handler.py:main
// tools/summarize_file/input.schema.json
{
  "type": "object",
  "properties": {
    "path": { "type": "string" }
  },
  "required": ["path"]
}
# tools/summarize_file/handler.py
def main(input):
    return {"summary": "..."}