From 34e00404e9561dcaf8d2d99df7470757a4fee915 Mon Sep 17 00:00:00 2001 From: tanaka takashi Date: Wed, 1 Jul 2026 00:17:40 +0900 Subject: tool description最適化 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/mcp_protocol_test.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tests/mcp_protocol_test.py') diff --git a/tests/mcp_protocol_test.py b/tests/mcp_protocol_test.py index 4d1deb2..2dc70ff 100644 --- a/tests/mcp_protocol_test.py +++ b/tests/mcp_protocol_test.py @@ -128,6 +128,40 @@ def main() -> None: "rebuild_index", "get_system_health", } + expected_descriptions = { + "write_message": "Append and durably persist a conversation message. Use it to store information that should remain available after server restarts.", + "read_messages": "Read persisted messages from one known session in chronological order. Returns a paginated history for reconstructing that conversation.", + "search_messages": "Search persisted message content and tags by text relevance. Use it to recall matching information globally or within one session.", + "delete_message": "Delete a persisted message so it is immediately excluded from reads and searches. Physical removal occurs after rebuild_index compacts the store.", + "rebuild_index": "Compact the store and rebuild its snapshot and in-memory indexes. Use it for maintenance or to physically remove logically deleted records; it may block other requests while running.", + "get_system_health": "Inspect storage health, recovery state, message counts, and file sizes. Use it to diagnose persistence or recovery problems.", + } + assert {name: tool["description"] for name, tool in tools.items()} == expected_descriptions + expected_property_descriptions = { + "write_message": { + "session_id": "Conversation session that owns the message.", + "role": "Message author role: user, assistant, or system.", + "content": "UTF-8 message text to persist.", + "metadata_json": "Optional JSON object string containing tool_call_id, tags, and/or memory_tier; defaults to {}.", + }, + "read_messages": { + "session_id": "Conversation session whose chronological history to read.", + "limit": "Maximum messages to return in this page, from 1 to 1000; defaults to 100.", + "cursor": "Opaque nextCursor returned by a previous read_messages call; omit for the first page.", + }, + "search_messages": { + "query": "UTF-8 text to match against persisted message content and tags.", + "session_id": "Conversation session to search; omit to search across all sessions.", + "limit": "Maximum ranked matches to return, from 1 to 100; defaults to 20.", + }, + "delete_message": { + "message_id": "Canonical 26-character ULID of the message to delete.", + "session_id": "Optional session guard; when provided, delete only if the message belongs to this session.", + }, + } + for tool_name, descriptions in expected_property_descriptions.items(): + properties = tools[tool_name]["inputSchema"]["properties"] + assert {name: value["description"] for name, value in properties.items()} == descriptions assert tools["write_message"]["inputSchema"]["required"] == [ "session_id", "role", -- cgit v1.2.3