Skip to content

[FEATURE] Add limit parameter to search_vault_simple tool #62

@JasonBates

Description

@JasonBates

Feature Description

Add an optional limit parameter to the search_vault_simple tool to cap the number of matching files returned.

Use Case & Motivation

When using search_vault_simple in Claude Desktop (or other MCP clients with context limits), searches for common terms return so many results that the response overflows the context window. The tool result gets stored to a file with a message like:

Tool result too large for context, stored at /mnt/user-data/tool_results/...

This breaks the conversational flow and requires workarounds (grep, head/tail on the stored file).

The search_vault_smart tool already has a limit option in its filter object, making it much more usable. Adding the same capability to search_vault_simple would bring parity and make the tool practical for large vaults.

Proposed Solution

Add an optional limit parameter (integer) to search_vault_simple. When provided, return only the first N matching files.

// Current
{ query: string, contextLength?: number }

// Proposed  
{ query: string, contextLength?: number, limit?: number }

Alternatives Considered

  • Setting contextLength: 1 — Reduces payload per match but doesn't limit file count. Still overflows on common terms.
  • Using search_vault_smart instead — Works for semantic/relevance searches, but sometimes you need exact text matching.
  • Using search_vault with Dataview — More powerful but heavier; simple search should handle simple cases.

Implementation Notes

  • Package affected: mcp-server
  • Change scope: Likely small — add parameter to schema, slice results array before return
  • No new dependencies required

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions