Skip to content

Commit 94670b3

Browse files
fix: Add explicit type annotations to MCP tool parameters
Fixes #393 - Add TagType annotation to write_note.tags parameter - Replace StringOrInt type alias with inline union type in build_context.depth - Ensures MCP protocol compatibility with clients that require explicit types MCP clients like qwen code were skipping these tools due to missing or non-serializable type information in parameter schemas. All MCP tool parameters must have explicit, JSON-serializable type annotations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Paul Hernandez <phernandez@users.noreply.github.com>
1 parent c7e6eab commit 94670b3

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

src/basic_memory/mcp/tools/build_context.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
memory_url_path,
1717
)
1818

19-
type StringOrInt = str | int
20-
2119

2220
@mcp.tool(
2321
description="""Build context from a memory:// URI to continue conversations naturally.
@@ -39,7 +37,7 @@
3937
async def build_context(
4038
url: MemoryUrl,
4139
project: Optional[str] = None,
42-
depth: Optional[StringOrInt] = 1,
40+
depth: str | int | None = 1,
4341
timeframe: Optional[TimeFrame] = "7d",
4442
page: int = 1,
4543
page_size: int = 10,

src/basic_memory/mcp/tools/write_note.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async def write_note(
2828
content: str,
2929
folder: str,
3030
project: Optional[str] = None,
31-
tags=None,
31+
tags: TagType = None,
3232
entity_type: str = "note",
3333
context: Context | None = None,
3434
) -> str:

0 commit comments

Comments
 (0)