search_memo
Search for memos by keywords to find specific notes and information stored in the MCP Server Memos system.
Instructions
Search for memos
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key_word | Yes | The key words to search for in the memo content. |
Implementation Reference
- src/mcp_server_memos/server.py:95-107 (handler)The handler function in MemoServiceToolAdapter that validates input, calls the memos API to list memos matching the keyword, and returns the search results as text content.async def search_memo(self, args: dict) -> list[types.TextContent]: try: params = SearchMemoRequest.model_validate(args) except Exception as e: raise McpError(types.INVALID_PARAMS, str(e)) req = memos_api_v1.ListMemosRequest( filter=f"row_status == 'NORMAL' && content_search == ['{params.key_word}']" ) res = await self.memo_service.list_memos(list_memos_request=req) content = ", ".join([memo.content for memo in res.memos]) content = f"Search result:\n{content}" return [types.TextContent(type="text", text=content)]
- src/mcp_server_memos/server.py:29-39 (schema)Pydantic BaseModel defining the input schema for the search_memo tool, with a required 'key_word' field.class SearchMemoRequest(BaseModel): """Request to search memo""" key_word: Annotated[ str, Field( description="""The key words to search for in the memo content.""", ), ]
- src/mcp_server_memos/server.py:160-164 (registration)Registration of the 'search_memo' tool in the list_tools() decorator, specifying name, description, and input schema.types.Tool( name=MemosTools.SEARCH_MEMO, description="Search for memos", inputSchema=SearchMemoRequest.model_json_schema(), ),
- src/mcp_server_memos/server.py:185-186 (registration)Dispatch logic in the call_tool() decorator that routes calls to the search_memo handler when the tool name matches.if name == MemosTools.SEARCH_MEMO: return await tool_adapter.search_memo(args)
- src/mcp_server_memos/server.py:15-15 (helper)Constant definition for the tool name within the MemosTools enum.SEARCH_MEMO = "search_memo"