import { VaultProvider } from '../vault/provider.js';
/**
* Base class for all MCP tools
* Extend this class to create new tools that automatically get registered
*/
export abstract class BaseTool {
/**
* The name of the tool (used by Claude to invoke it)
*/
abstract readonly name: string;
/**
* Human-readable description of what the tool does
*/
abstract readonly description: string;
/**
* JSON Schema defining the tool's input parameters
*/
abstract readonly inputSchema: {
type: 'object';
properties: Record<string, any>;
required?: string[];
};
/**
* Reference to the vault provider (injected by the server)
*/
protected vault!: VaultProvider;
/**
* Set the vault provider (called by the server during registration)
*/
setVault(vault: VaultProvider): void {
this.vault = vault;
}
/**
* Execute the tool with the given parameters
* @param params - Validated parameters matching the inputSchema
* @returns Result object that will be sent back to Claude
*/
abstract execute(params: any): Promise<any>;
/**
* Convert tool to MCP tool format
*/
toMCPTool() {
return {
name: this.name,
description: this.description,
inputSchema: this.inputSchema,
};
}
}