This repository contains custom agent tools for your organization. Each tool is a folder in tools/ with a tool.json and index.ts. The package manager is pnpm.
tools/
my-tool/
tool.json # Tool metadata with UUID
index.ts # Tool implementation (exports default async function)
src/clients/ # Auto-generated resource clients
resources.json # Auto-generated resource registry
{
"id": "<auto-generated uuid>",
"name": "my-tool",
"description": "What the tool does",
"inputSchema": {
"type": "object",
"properties": {
"param1": { "type": "string", "description": "..." }
},
"required": ["param1"]
}
}Every tool's index.ts default-exports a handler that receives two arguments: the tool input and a context object injected per-request by the MCP server.
import { createMyDbClient } from "./src/clients";
interface ToolInput {
param1: string;
}
interface ToolContext {
resourceApiUrl: string;
majorJwtToken: string;
}
export default async function(input: ToolInput, context: ToolContext) {
const db = createMyDbClient(context);
const result = await db.invoke("SELECT ...", [], "my-query");
if (!result.ok) {
throw new Error(result.error.message);
}
return result.result;
}Never read auth values from process.env -- always use context.
cd tools/<tool-name>
pnpx major-client add "<resourceId>" "<clientName>" "<type>" "<description>" --mode toolThis creates type-safe factory functions in src/clients/ with the tool's ID from tool.json hardcoded at generation time. Create a client instance inside the handler on every call -- do not cache globally. If the tool's UUID changes, regenerate all resource clients.
All tools share the root package.json. To add a dependency:
pnpm add <package-name>