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; break;
} }
case "get_vault_info": case "get_vault_info":
result = await this.vaultTools.getVaultInfo(); result = this.vaultTools.getVaultInfo();
break; break;
case "list": { 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 }; 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": { case "exists": {
const a = args as { path: string }; const a = args as { path: string };
result = await this.vaultTools.exists(a.path); result = this.vaultTools.exists(a.path);
break; break;
} }
case "read_excalidraw": { case "read_excalidraw": {
@@ -629,7 +629,7 @@ export class ToolRegistry {
} }
case "resolve_wikilink": { case "resolve_wikilink": {
const a = args as { sourcePath: string; linkText: string }; 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; break;
} }
case "backlinks": { case "backlinks": {

View File

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