fix: remove async from methods without await in vault-tools.ts

This commit is contained in:
2025-12-16 13:45:30 -05:00
parent e1e05e82ae
commit 3b50754386
2 changed files with 10 additions and 10 deletions

View File

@@ -577,7 +577,7 @@ export class ToolRegistry {
break;
}
case "get_vault_info":
result = await this.vaultTools.getVaultInfo();
result = this.vaultTools.getVaultInfo();
break;
case "list": {
const a = args as { path?: string; recursive?: boolean; includes?: string[]; excludes?: string[]; only?: 'files' | 'directories' | 'any'; limit?: number; cursor?: string; withFrontmatterSummary?: boolean; includeWordCount?: boolean };
@@ -601,7 +601,7 @@ export class ToolRegistry {
}
case "exists": {
const a = args as { path: string };
result = await this.vaultTools.exists(a.path);
result = this.vaultTools.exists(a.path);
break;
}
case "read_excalidraw": {
@@ -629,7 +629,7 @@ export class ToolRegistry {
}
case "resolve_wikilink": {
const a = args as { sourcePath: string; linkText: string };
result = await this.vaultTools.resolveWikilink(a.sourcePath, a.linkText);
result = this.vaultTools.resolveWikilink(a.sourcePath, a.linkText);
break;
}
case "backlinks": {

View File

@@ -15,7 +15,7 @@ export class VaultTools {
private metadata: IMetadataCacheAdapter
) {}
async getVaultInfo(): Promise<CallToolResult> {
getVaultInfo(): CallToolResult {
try {
const allFiles = this.vault.getMarkdownFiles();
const totalNotes = allFiles.length;
@@ -60,7 +60,7 @@ export class VaultTools {
return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + ' ' + sizes[i];
}
async listNotes(path?: string): Promise<CallToolResult> {
listNotes(path?: string): CallToolResult {
let items: Array<FileMetadata | DirectoryMetadata> = [];
// Normalize root path: undefined, empty string "", or "." all mean root
@@ -279,7 +279,7 @@ export class VaultTools {
// Apply type filtering and add items
if (item instanceof TFile) {
if (only !== 'directories') {
const fileMetadata = await this.createFileMetadataWithFrontmatter(item, withFrontmatterSummary || false);
const fileMetadata = this.createFileMetadataWithFrontmatter(item, withFrontmatterSummary || false);
// Optionally include word count (best effort)
if (includeWordCount) {
@@ -307,10 +307,10 @@ export class VaultTools {
}
}
private async createFileMetadataWithFrontmatter(
private createFileMetadataWithFrontmatter(
file: TFile,
withFrontmatterSummary: boolean
): Promise<FileMetadataWithFrontmatter> {
): FileMetadataWithFrontmatter {
const baseMetadata = this.createFileMetadata(file);
if (!withFrontmatterSummary || file.extension !== 'md') {
@@ -495,7 +495,7 @@ export class VaultTools {
};
}
async exists(path: string): Promise<CallToolResult> {
exists(path: string): CallToolResult {
// Validate path
if (!PathUtils.isValidVaultPath(path)) {
return {
@@ -922,7 +922,7 @@ export class VaultTools {
* Resolve a single wikilink from a source note
* Returns the target path if resolvable, or suggestions if not
*/
async resolveWikilink(sourcePath: string, linkText: string): Promise<CallToolResult> {
resolveWikilink(sourcePath: string, linkText: string): CallToolResult {
try {
// Normalize and validate source path
const normalizedPath = PathUtils.normalizePath(sourcePath);