diff --git a/src/meilisearch_mcp/client.py b/src/meilisearch_mcp/client.py index c7c5b5a..19d0f22 100644 --- a/src/meilisearch_mcp/client.py +++ b/src/meilisearch_mcp/client.py @@ -18,7 +18,11 @@ class MeilisearchClient: def __init__( self, url: str = "http://localhost:7700", api_key: Optional[str] = None ): - """Initialize Meilisearch client""" + """ + Initializes a MeilisearchClient instance for interacting with a Meilisearch server. + + Creates an internal client with a custom user agent and sets up managers for indexes, documents, settings, tasks, keys, and monitoring. + """ self.url = url self.api_key = api_key # Add custom user agent to identify this as Meilisearch MCP diff --git a/tests/test_user_agent.py b/tests/test_user_agent.py index 9e701a5..ef68170 100644 --- a/tests/test_user_agent.py +++ b/tests/test_user_agent.py @@ -5,7 +5,11 @@ def test_meilisearch_client_sets_custom_user_agent(): - """Test that MeilisearchClient initializes with custom user agent""" + """ + Verifies that MeilisearchClient sets a custom user agent string during initialization. + + This test ensures that the internal Client is instantiated with the correct URL, API key, and a client_agents tuple containing the package name and version. + """ with patch("src.meilisearch_mcp.client.Client") as mock_client: # Create a MeilisearchClient instance client = MeilisearchClient(url="http://localhost:7700", api_key="test_key") @@ -19,7 +23,11 @@ def test_meilisearch_client_sets_custom_user_agent(): def test_user_agent_includes_correct_version(): - """Test that the user agent includes the correct version from __version__.py""" + """ + Verifies that MeilisearchClient sets the user agent to include the correct version string. + + This test ensures that the internal client is initialized with a user agent tuple containing the package name and the version string from the __version__ module. + """ with patch("src.meilisearch_mcp.client.Client") as mock_client: client = MeilisearchClient()