mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
5b4f0eafcc
* configure logging * set mcp output logging also * fix type check errors * fix type check * rename Permalink schema type * fix type errors * add typechecks to ci workflow * pytest coverage setup * add tests for status cli * sync tests coverage * watch_service test coverage * tests for tool_utils.py * clean up imports * file_utils coverage * markdown plugins coverage * 99% test coverage * more test coverage, remove ObservationCategory * more tool coverage * fix type-check * format, upgrade deps --------- Co-authored-by: phernandez <phernandez@basicmachines.co>
30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
"""Search tools for Basic Memory MCP server."""
|
|
|
|
from loguru import logger
|
|
|
|
from basic_memory.mcp.server import mcp
|
|
from basic_memory.mcp.tools.utils import call_post
|
|
from basic_memory.schemas.search import SearchQuery, SearchResponse
|
|
from basic_memory.mcp.async_client import client
|
|
|
|
|
|
@mcp.tool(
|
|
description="Search across all content in basic-memory, including documents and entities",
|
|
)
|
|
async def search(query: SearchQuery) -> SearchResponse:
|
|
"""Search across all content in basic-memory.
|
|
|
|
Args:
|
|
query: SearchQuery object with search parameters including:
|
|
- text: Search text (required)
|
|
- types: Optional list of content types to search ("document" or "entity")
|
|
- entity_types: Optional list of entity types to filter by
|
|
- after_date: Optional date filter for recent content
|
|
|
|
Returns:
|
|
SearchResponse with search results and metadata
|
|
"""
|
|
logger.info(f"Searching for {query.text}")
|
|
response = await call_post(client, "/search/", json=query.model_dump())
|
|
return SearchResponse.model_validate(response.json())
|