Skip to content

[BUG] Bug Report (via AI Assistant): search_notes Tool Unusable Due to Conflicting Query Parameter Definition #94

@azuma520

Description

@azuma520

Bug Description
The search_notes tool within the Basic Memory MCP server has conflicting definitions for its query parameter between its API schema (used by clients like AI assistants) and its actual source code implementation. The API schema expects query as an object (McpBasicMemorySearchNotesQuery), while the source code expects query as a string (str). This conflict makes the tool unusable via the API, as calls fail regardless of whether the parameter is sent as an object or a string.
Steps To Reproduce
Steps to reproduce the behavior:
Interact with the Basic Memory MCP server via an API client that adheres to the provided tool schema (e.g., an AI assistant like Gemini/Claude connected via the API).
Attempt to call the mcp_basic_memory_search_notes tool (or its equivalent API endpoint /search/) with the query parameter formatted as an object according to the schema (e.g., query={"title": "Some Title"} or query={"text": "Some Text"}).
Observe an error related to parameter type mismatch (e.g., Error calling tool: Parameter 'query' must be of type undefined, got object). The exact error might vary depending on internal handling, but it fails.
Attempt to call the same tool with the query parameter formatted as a string, matching the source code signature (e.g., query="Some Title", potentially with search_type="title").
Observe a different parameter type mismatch error, indicating the call violates the API schema (e.g., Error calling tool: Parameter 'query' must be of type undefined, got string).
(Refer to the source code snippet below in Additional Context which confirms query: str)
Expected Behavior
The search_notes tool should be callable via its API according to a consistent definition. Either:
A) The API schema should accurately reflect the source code, defining query as a string (str), and calls with a string query should succeed.
B) The source code should be updated to accept the object type defined in the API schema (McpBasicMemorySearchNotesQuery), and calls with the object query should succeed.
Actual Behavior
Attempts to call the search_notes tool via the API consistently fail with parameter type errors due to the conflict between the API schema and the code implementation.
Sending query as an object results in errors like: Parameter 'query' must be of type undefined, got object.
Sending query as a string results in errors like: Parameter 'query' must be of type undefined, got string.
The tool is effectively unusable through the documented API schema.
Environment
OS: Windows 11 (win32 10.0.22631)
Python version: 3.12.7
Basic Memory version: 0.11.0
Installation method: uv
Interaction Method: Via AI Assistant API (Gemini Pro in Cursor) utilizing the provided MCP tool schema.
Additional Context
The API schema provided to the AI assistant defines the query parameter for mcp_basic_memory_search_notes as requiring an object of type McpBasicMemorySearchNotesQuery.
The relevant source code snippet provided by the user shows the function signature expects a string:
Apply
Possible Solution
Align the API schema definition (provided to clients like AI assistants) with the actual function signature in the source code. The most straightforward fix appears to be updating the API schema to define the query parameter as a string (str) and remove the requirement for the McpBasicMemorySearchNotesQuery object structure for this specific parameter in the API call definition. Alternatively, update the function code to correctly parse the McpBasicMemorySearchNotesQuery object passed via the API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions