Skip to main content
Glama
disnet
by disnet

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
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that empty queries return all notes sorted by last updated, which is useful context. However, it doesn't cover critical aspects like pagination behavior (beyond the 'limit' parameter), error handling, rate limits, or authentication needs, leaving significant gaps for a search tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with two sentences that directly convey key information: the tool's purpose and a behavioral note about empty queries. Every word earns its place, and it's front-loaded with the core functionality.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (6 parameters, no output schema, no annotations), the description is adequate but incomplete. It covers the basic purpose and one behavioral trait, but lacks details on output format, error cases, or performance characteristics. Without annotations or an output schema, more context would be helpful for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 6 parameters thoroughly. The description adds minimal value beyond the schema: it implies that 'query' and 'type_filter' are the primary search criteria, but doesn't provide additional syntax, format details, or examples. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Search notes by content and/or type.' It specifies the verb ('search') and resource ('notes'), and mentions the search criteria. However, it doesn't explicitly differentiate from siblings like 'search_notes_advanced' or 'search_notes_sql', which would be needed for a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides some implied usage guidance: 'Empty queries return all notes sorted by last updated.' This suggests when to use it for unfiltered retrieval. However, it lacks explicit guidance on when to choose this tool over alternatives like 'search_notes_advanced' or 'search_notes_sql', and doesn't mention prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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