Skip to content

Commit 39274da

Browse files
jope-bmclaude
andcommitted
refactor: Use modern Python type alias for StringOrInt in build_context
Replace Union[int, str] with cleaner StringOrInt type alias using modern Python 3.12+ type statement syntax. This improves code readability while maintaining the same functionality for string-to-integer conversion in the depth parameter. Changes: - Add StringOrInt type alias using modern type statement - Update depth parameter annotation to use StringOrInt - Maintains all existing string conversion and validation logic 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Joe P <joe@basicmemory.com>
1 parent b4d8fa9 commit 39274da

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/basic_memory/mcp/tools/build_context.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
memory_url_path,
1616
)
1717

18+
type StringOrInt = str | int
1819

1920
@mcp.tool(
2021
description="""Build context from a memory:// URI to continue conversations naturally.
@@ -35,7 +36,7 @@
3536
)
3637
async def build_context(
3738
url: MemoryUrl,
38-
depth: Optional[Union[int, str]] = 1,
39+
depth: Optional[StringOrInt] = 1,
3940
timeframe: Optional[TimeFrame] = "7d",
4041
page: int = 1,
4142
page_size: int = 10,

0 commit comments

Comments
 (0)