Skip to main content
Glama

search_notes

Find notes by content or type in Flint Note's vault. Use queries, filters, or regex to locate specific markdown files for AI collaboration.

Instructions

Search notes by content and/or type. Empty queries return all notes sorted by last updated.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoSearch query or regex pattern. Empty string or omitted returns all notes.
type_filterNoOptional filter by note type
limitNoMaximum number of results to return
use_regexNoEnable regex pattern matching
vault_idNoOptional vault ID to operate on. If not provided, uses the current active vault.
fieldsNoOptional array of field names to include in response. Supports dot notation for nested fields (e.g. "metadata.tags") and wildcard patterns (e.g. "metadata.*"). If not specified, all fields are returned.

Implementation Reference

  • The primary handler function for the 'search_notes' MCP tool. Validates input, resolves vault context, executes search via HybridSearchManager, applies field filtering, and formats results as JSON text content.
    handleSearchNotes = async (args: SearchNotesArgs) => { // Validate arguments validateToolArgs('search_notes', args); const { hybridSearchManager } = await this.resolveVaultContext(args.vault_id); const results = await hybridSearchManager.searchNotes( args.query, args.type_filter, args.limit, args.use_regex ); // Apply field filtering if specified const filteredResults = args.fields ? results.map(result => filterNoteFields(result, args.fields)) : results; return { content: [ { type: 'text', text: JSON.stringify(filteredResults, null, 2) } ] }; };
  • Registration of the 'search_notes' tool in the MCP server's CallToolRequestSchema handler switch statement, mapping the tool name to the SearchHandlers.handleSearchNotes method.
    case 'search_notes': return await this.searchHandlers.handleSearchNotes( args as unknown as SearchNotesArgs );
  • The JSON schema definition for the 'search_notes' tool input parameters, exported in TOOL_SCHEMAS array.
    name: 'search_notes', description: 'Search notes by content and/or type. Empty queries return all notes sorted by last updated.', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query or regex pattern. Empty string or omitted returns all notes.' }, type_filter: { type: 'string', description: 'Filter results to specific note type' }, limit: { type: 'number', description: 'Maximum number of results to return' }, use_regex: { type: 'boolean', description: 'Treat query as regex pattern', default: false }, vault_id: { type: 'string', description: 'Optional vault ID to search in. If not provided, uses the current active vault.' }, fields: { type: 'array', items: { type: 'string' }, description: 'Optional list of fields to include in response (id, title, content, type, filename, path, created, updated, size, metadata)' } } } },
  • TypeScript interface definition for SearchNotesArgs used by the handler.
    export interface SearchNotesArgs { query?: string; type_filter?: string; limit?: number; use_regex?: boolean; vault_id?: string; fields?: string[]; }
  • Core search implementation in HybridSearchManager.searchNotes, called by the tool handler. Performs hybrid text + SQL search. Note: exact lines approximated from search match.
    async searchNotes( query: string | undefined, typeFilter: string | null = null, limit: number = 10, useRegex: boolean = false ): Promise<SearchResult[]> { const connection = await this.getReadOnlyConnection(); try { const safeQuery = (query ?? '').trim(); let sql: string; let params: (string | number)[] = []; if (!safeQuery) { // Return all notes sql = ` SELECT n.*, 1.0 as score FROM notes n ${typeFilter ? 'WHERE n.type = ?' : ''} ORDER BY n.updated DESC LIMIT ? `; params = typeFilter ? [typeFilter, limit] : [limit]; } else if (useRegex) { // For regex search, fetch all notes and filter in JavaScript

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/disnet/flint-note'

If you have feedback or need assistance with the MCP directory API, please join our Discord server