find_broken_links
Identify and resolve broken wikilinks within your note vault, ensuring accurate connections and seamless navigation in Flint Note’s AI-collaborative system.
Instructions
Find all broken wikilinks (links to non-existent notes)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"required": [],
"type": "object"
}
Implementation Reference
- src/server/link-handlers.ts:136-182 (handler)The main MCP tool handler for find_broken_links. Resolves vault context, validates optional vault_id argument, calls LinkExtractor.findBrokenLinks, and returns JSON response with broken links list and count.handleFindBrokenLinks = async (args?: { vault_id?: string }) => { try { // Validate arguments if (args) { validateToolArgs('find_broken_links', args); } const { hybridSearchManager } = await this.resolveVaultContext(args?.vault_id); const db = await hybridSearchManager.getDatabaseConnection(); const brokenLinks = await LinkExtractor.findBrokenLinks(db); return { content: [ { type: 'text', text: JSON.stringify( { success: true, broken_links: brokenLinks, count: brokenLinks.length }, null, 2 ) } ] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error'; return { content: [ { type: 'text', text: JSON.stringify( { success: false, error: errorMessage }, null, 2 ) } ], isError: true }; } };
- src/server/tool-schemas.ts:909-917 (schema)The JSON schema definition for the find_broken_links tool, defining it as optional arguments with no required properties.{ name: 'find_broken_links', description: 'Find all broken wikilinks (links to non-existent notes)', inputSchema: { type: 'object', properties: {}, required: [] } },
- src/core/link-extractor.ts:323-327 (helper)Core helper method that executes the SQL query to find all broken wikilinks (note_links where target_note_id is NULL), ordered by source note and line number.static async findBrokenLinks(db: DatabaseConnection): Promise<NoteLinkRow[]> { return await db.all<NoteLinkRow>( `SELECT * FROM note_links WHERE target_note_id IS NULL ORDER BY source_note_id, line_number` ); }
- src/server/validation.ts:847-854 (schema)Validation rules used by validateToolArgs for the find_broken_links tool, specifying optional vault_id string parameter.find_broken_links: [ { field: 'vault_id', required: false, type: 'string', allowEmpty: false } ],