types.ts•1.44 kB
import { z } from "zod";
/**
* Common response type for tool handlers
*/
export type ToolResponse = {
content: {
type: "text";
text: string;
}[];
isError?: boolean;
};
/**
* Tool definition interface
*/
export interface ToolDefinition {
name: string;
description: string;
schema: any;
}
/**
* Tool handler function type
*/
export type ToolHandler = (params: any) => Promise<ToolResponse>;
/**
* Obsidian API types
*/
export interface NoteJson {
content: string;
frontmatter: Record<string, any>;
path: string;
stat: {
ctime: number;
mtime: number;
size: number;
};
tags: string[];
}
export interface PatchNoteOptions {
operation: "append" | "prepend" | "replace"; // Patch operation to perform; required
targetType: "heading" | "block" | "frontmatter"; // Type of target to patch; required
target: string; // Target to patch (URL-Encoded if needed); required
targetDelimiter?: string; // Delimiter to use for nested targets (i.e. Headings); optional (default "::")
trimTargetWhitespace?: boolean; // Trim whitespace from Target before applying patch?; optional (default "false")
contentType?: string; // Content-Type header used for request body; optional (default "text/markdown")
}
export interface AdvancedSearchResult {
filename: string;
// result can be string, number, array, object, or boolean
result: string | number | any[] | Record<string, any> | boolean;
}