Extend
Custom tools
Add your own tools in TypeScript.
#Define a tool
my-tool.ts
import { z } from "zod";
export const schema = z.object({
query: z.string().describe("What to search for"),
});
export async function execute({ query }: z.infer<typeof schema>) {
return search(query);
}- Schema: a Zod object declares the tool's parameters and their descriptions.
- Execute: an async function receiving the validated input and returning the result.
Custom tools run as code on your machine with your full permissions. Only install tools you trust.
#Load
- Project folder: drop tool files into
.codey/tools/and they load automatically. - NPM plugin: ship tools inside an NPM plugin and reference it from the plugin config.
#See also
MCP servers · Skills · Config