Skip to main content
Glama

search_notes_advanced

Filter and sort notes by type, metadata, dates, or content to quickly find specific information. Use structured advanced search for precise, organized results.

Instructions

Advanced search with structured filters for metadata, dates, and content

Input Schema

NameRequiredDescriptionDefault
content_containsNoSearch within note content
created_beforeNoFind notes created before time period
created_withinNoFind notes created within time period
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.
limitNoMaximum number of results
metadata_filtersNoArray of metadata filters
offsetNoNumber of results to skip
sortNoSort order for results
typeNoFilter by note type
updated_beforeNoFind notes updated before time period (e.g., "7d", "1w", "2m")
updated_withinNoFind notes updated within time period (e.g., "7d", "1w", "2m")
vault_idNoOptional vault ID to operate on. If not provided, uses the current active vault.

Input Schema (JSON Schema)

{ "properties": { "content_contains": { "description": "Search within note content", "type": "string" }, "created_before": { "description": "Find notes created before time period", "type": "string" }, "created_within": { "description": "Find notes created within time period", "type": "string" }, "fields": { "description": "Optional 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.", "items": { "type": "string" }, "type": "array" }, "limit": { "default": 50, "description": "Maximum number of results", "type": "number" }, "metadata_filters": { "description": "Array of metadata filters", "items": { "properties": { "key": { "description": "Metadata key to filter on", "type": "string" }, "operator": { "default": "=", "description": "Comparison operator", "enum": [ "=", "!=", ">", "<", ">=", "<=", "LIKE", "IN" ], "type": "string" }, "value": { "description": "Value to match", "type": "string" } }, "required": [ "key", "value" ], "type": "object" }, "type": "array" }, "offset": { "default": 0, "description": "Number of results to skip", "type": "number" }, "sort": { "description": "Sort order for results", "items": { "properties": { "field": { "enum": [ "title", "type", "created", "updated", "size" ], "type": "string" }, "order": { "enum": [ "asc", "desc" ], "type": "string" } }, "required": [ "field", "order" ], "type": "object" }, "type": "array" }, "type": { "description": "Filter by note type", "type": "string" }, "updated_before": { "description": "Find notes updated before time period (e.g., \"7d\", \"1w\", \"2m\")", "type": "string" }, "updated_within": { "description": "Find notes updated within time period (e.g., \"7d\", \"1w\", \"2m\")", "type": "string" }, "vault_id": { "description": "Optional vault ID to operate on. If not provided, uses the current active vault.", "type": "string" } }, "required": [], "type": "object" }

Implementation Reference

  • The primary handler function for the 'search_notes_advanced' MCP tool. It validates input arguments, resolves the vault context, executes the advanced search via HybridSearchManager, applies optional field filtering, and returns the results as formatted JSON text content.
    handleSearchNotesAdvanced = async (args: SearchNotesAdvancedArgs) => { // Validate arguments validateToolArgs('search_notes_advanced', args); const { hybridSearchManager } = await this.resolveVaultContext(args.vault_id); const results = await hybridSearchManager.searchNotesAdvanced(args); // Apply field filtering if specified const filteredResults = filterSearchResults(results, args.fields); return { content: [ { type: 'text', text: JSON.stringify(filteredResults, null, 2) } ] }; };
  • Tool dispatch registration in the CallToolRequestSchema handler's switch statement, routing calls to the SearchHandlers.handleSearchNotesAdvanced method.
    case 'search_notes_advanced': return await this.searchHandlers.handleSearchNotesAdvanced( args as unknown as SearchNotesAdvancedArgs );
  • Tool schema definition including name, description, and detailed inputSchema advertised in the ListToolsRequestSchema response.
    name: 'search_notes_advanced', description: 'Advanced search with structured filters for metadata, dates, and content', inputSchema: { type: 'object', properties: { type: { type: 'string', description: 'Filter by note type' }, metadata_filters: { type: 'array', items: { type: 'object', properties: { key: { type: 'string', description: 'Metadata key to filter on' }, value: { type: 'string', description: 'Value to match' }, operator: { type: 'string', enum: ['=', '!=', '>', '<', '>=', '<=', 'LIKE', 'IN'], default: '=', description: 'Comparison operator' } }, required: ['key', 'value'] }, description: 'Array of metadata filters' }, updated_within: { type: 'string', description: 'Find notes updated within time period (e.g., "7d", "1w", "2m")' }, updated_before: { type: 'string', description: 'Find notes updated before time period (e.g., "7d", "1w", "2m")' }, created_within: { type: 'string', description: 'Find notes created within time period' }, created_before: { type: 'string', description: 'Find notes created before time period' }, content_contains: { type: 'string', description: 'Search within note content' }, sort: { type: 'array', items: { type: 'object', properties: { field: { type: 'string', enum: ['title', 'type', 'created', 'updated', 'size'] }, order: { type: 'string', enum: ['asc', 'desc'] } }, required: ['field', 'order'] }, description: 'Sort order for results' }, limit: { type: 'number', description: 'Maximum number of results', default: 50 }, offset: { type: 'number', description: 'Number of results to skip', default: 0 }, vault_id: { type: 'string', description: 'Optional vault ID to operate on. If not provided, uses the current active vault.' }, fields: { type: 'array', items: { type: 'string' }, description: 'Optional 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.' } }, required: [] } },
  • TypeScript interface defining the structure of arguments accepted by the search_notes_advanced tool handler.
    export interface SearchNotesAdvancedArgs { type?: string; metadata_filters?: Array<{ key: string; value: string; operator?: '=' | '!=' | '>' | '<' | '>=' | '<=' | 'LIKE' | 'IN'; }>; updated_within?: string; updated_before?: string; created_within?: string; created_before?: string; content_contains?: string; sort?: Array<{ field: 'title' | 'type' | 'created' | 'updated' | 'size'; order: 'asc' | 'desc'; }>; limit?: number; offset?: number; vault_id?: string; fields?: string[]; }
  • Call to validation utility that performs input validation specific to search_notes_advanced tool arguments.
    validateToolArgs('search_notes_advanced', args); const { hybridSearchManager } = await this.resolveVaultContext(args.vault_id); const results = await hybridSearchManager.searchNotesAdvanced(args); // Apply field filtering if specified const filteredResults = filterSearchResults(results, args.fields); return { content: [ { type: 'text', text: JSON.stringify(filteredResults, null, 2) } ] }; };

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