Skip to main content
Glama
RyoJerryYu

MCP Server Memos

by RyoJerryYu

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
NameRequiredDescriptionDefault
key_wordYesThe key words to search for in the memo content.

Implementation Reference

  • 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)]
  • 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.""",
            ),
        ]
  • 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(),
    ),
  • 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)
  • Constant definition for the tool name within the MemosTools enum.
    SEARCH_MEMO = "search_memo"
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/RyoJerryYu/mcp-server-memos-py'

If you have feedback or need assistance with the MCP directory API, please join our Discord server