Skip to content

[BUG] #797

@phlaster

Description

@phlaster

Bug Description

The write_note, read_note, canvas, search_notes, and recent_activity tools in basic-memory MCP consistently fail Pydantic validation when invoked by a local LLM (qwen3.6-27b, quite capable in toolcalling in other situations). Input payloads contain malformed structures with unexpected keys like : [, [{, or fragmented JSON, suggesting a mismatch between the exposed MCP schema and the Pydantic validator.

Steps To Reproduce

  1. Install via uv: uvx basic-memory
  2. Configure MCP client to connect to the server
  3. Prompt the model to use any memory tool with standard parameters
  4. Observe ValidationError exceptions in server logs

Expected Behavior

Model generates valid tool calls matching Pydantic schemas; server accepts and processes them successfully.

Actual Behavior

Repeated validation failures across all tested tools. Representative error:

ValidationError: 3 validation errors for call[write_note]
title
  Missing required argument [type=missing_argument, input_value={'content': '...', ': [': [{}, '[{']}, input_type=dict]
: [
  Unexpected keyword argument [type=unexpected_keyword_argument, input_value=[{}, '[{'], input_type=list]

Key pattern: legitimate parameter values appear assigned to garbage keys (: [, [{), while required fields are reported missing. Failures are non-deterministic.

Environment

  • OS: CachyOS (Arch derivative)
  • Python: 3.13 | Basic Memory: 0.20.3 | uv: 0.11.10
  • LLM: Jackrong/Qwopus3.6-27B-v1-preview-Q4_K_M (LMStudio)
  • MCP client: standard mcp Python library

Additional Context

  • Issue persists across tools and prompts; no custom config used
  • Same model works with other MCP servers having simpler schemas
  • Error pattern suggests schema serialization or LLM interpretation issue, not model capability

Possible Solution

  1. Audit JSON Schema exposure via tools/list for ambiguity or mismatch with Pydantic models
  2. Add pre-validation logging to capture raw payloads before Pydantic processing
  3. Simplify tool schemas: flatten nested params, clarify field descriptions, avoid complex unions
  4. Consider lenient pre-processing to filter unknown keys before validation

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