Skip to content

Commit 280d880

Browse files
authored
Merge pull request #42 from meilisearch/fix/remove-unnecessary-async
Fix: Remove unnecessary async declarations from synchronous methods
2 parents 332c0ab + 0b941e3 commit 280d880

File tree

9 files changed

+57
-57
lines changed

9 files changed

+57
-57
lines changed

src/meilisearch_mcp/client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ def __init__(
2828
self.keys = KeyManager(self.client)
2929
self.monitoring = MonitoringManager(self.client)
3030

31-
async def health_check(self) -> bool:
31+
def health_check(self) -> bool:
3232
"""Check if Meilisearch is healthy"""
3333
try:
3434
response = self.client.health()
3535
return response.get("status") == "available"
3636
except Exception:
3737
return False
3838

39-
async def get_version(self) -> Dict[str, Any]:
39+
def get_version(self) -> Dict[str, Any]:
4040
"""Get Meilisearch version information"""
4141
return self.client.get_version()
4242

43-
async def get_stats(self) -> Dict[str, Any]:
43+
def get_stats(self) -> Dict[str, Any]:
4444
"""Get database stats"""
4545
return self.client.get_all_stats()
4646

47-
async def search(
47+
def search(
4848
self,
4949
query: str,
5050
index_uid: Optional[str] = None,
@@ -97,7 +97,7 @@ async def search(
9797
except Exception as e:
9898
raise Exception(f"Search failed: {str(e)}")
9999

100-
async def get_indexes(self) -> Dict[str, Any]:
100+
def get_indexes(self) -> Dict[str, Any]:
101101
"""Get all indexes"""
102102
indexes = self.client.get_indexes()
103103
# Convert Index objects to serializable dictionaries

src/meilisearch_mcp/documents.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class DocumentManager:
88
def __init__(self, client: Client):
99
self.client = client
1010

11-
async def get_documents(
11+
def get_documents(
1212
self,
1313
index_uid: str,
1414
offset: Optional[int] = None,
@@ -57,7 +57,7 @@ async def get_documents(
5757
except Exception as e:
5858
raise Exception(f"Failed to get documents: {str(e)}")
5959

60-
async def get_document(
60+
def get_document(
6161
self, index_uid: str, document_id: Union[str, int]
6262
) -> Dict[str, Any]:
6363
"""Get a single document"""
@@ -67,7 +67,7 @@ async def get_document(
6767
except Exception as e:
6868
raise Exception(f"Failed to get document: {str(e)}")
6969

70-
async def add_documents(
70+
def add_documents(
7171
self,
7272
index_uid: str,
7373
documents: List[Dict[str, Any]],
@@ -80,7 +80,7 @@ async def add_documents(
8080
except Exception as e:
8181
raise Exception(f"Failed to add documents: {str(e)}")
8282

83-
async def update_documents(
83+
def update_documents(
8484
self, index_uid: str, documents: List[Dict[str, Any]]
8585
) -> Dict[str, Any]:
8686
"""Update documents in an index"""
@@ -90,7 +90,7 @@ async def update_documents(
9090
except Exception as e:
9191
raise Exception(f"Failed to update documents: {str(e)}")
9292

93-
async def delete_document(
93+
def delete_document(
9494
self, index_uid: str, document_id: Union[str, int]
9595
) -> Dict[str, Any]:
9696
"""Delete a single document"""
@@ -100,7 +100,7 @@ async def delete_document(
100100
except Exception as e:
101101
raise Exception(f"Failed to delete document: {str(e)}")
102102

103-
async def delete_documents(
103+
def delete_documents(
104104
self, index_uid: str, document_ids: List[Union[str, int]]
105105
) -> Dict[str, Any]:
106106
"""Delete multiple documents by ID"""
@@ -110,7 +110,7 @@ async def delete_documents(
110110
except Exception as e:
111111
raise Exception(f"Failed to delete documents: {str(e)}")
112112

113-
async def delete_all_documents(self, index_uid: str) -> Dict[str, Any]:
113+
def delete_all_documents(self, index_uid: str) -> Dict[str, Any]:
114114
"""Delete all documents in an index"""
115115
try:
116116
index = self.client.index(index_uid)

src/meilisearch_mcp/indexes.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class IndexManager:
1717
def __init__(self, client: Client):
1818
self.client = client
1919

20-
async def create_index(
20+
def create_index(
2121
self, uid: str, primary_key: Optional[str] = None
2222
) -> Dict[str, Any]:
2323
"""Create a new index"""
@@ -26,35 +26,35 @@ async def create_index(
2626
except Exception as e:
2727
raise Exception(f"Failed to create index: {str(e)}")
2828

29-
async def get_index(self, uid: str) -> Dict[str, Any]:
29+
def get_index(self, uid: str) -> Dict[str, Any]:
3030
"""Get index information"""
3131
try:
3232
return self.client.get_index(uid)
3333
except Exception as e:
3434
raise Exception(f"Failed to get index: {str(e)}")
3535

36-
async def list_indexes(self) -> List[Dict[str, Any]]:
36+
def list_indexes(self) -> List[Dict[str, Any]]:
3737
"""List all indexes"""
3838
try:
3939
return self.client.get_indexes()
4040
except Exception as e:
4141
raise Exception(f"Failed to list indexes: {str(e)}")
4242

43-
async def delete_index(self, uid: str) -> Dict[str, Any]:
43+
def delete_index(self, uid: str) -> Dict[str, Any]:
4444
"""Delete an index"""
4545
try:
4646
return self.client.delete_index(uid)
4747
except Exception as e:
4848
raise Exception(f"Failed to delete index: {str(e)}")
4949

50-
async def update_index(self, uid: str, primary_key: str) -> Dict[str, Any]:
50+
def update_index(self, uid: str, primary_key: str) -> Dict[str, Any]:
5151
"""Update index primary key"""
5252
try:
5353
return self.client.update_index(uid, {"primaryKey": primary_key})
5454
except Exception as e:
5555
raise Exception(f"Failed to update index: {str(e)}")
5656

57-
async def swap_indexes(self, indexes: List[List[str]]) -> Dict[str, Any]:
57+
def swap_indexes(self, indexes: List[List[str]]) -> Dict[str, Any]:
5858
"""Swap indexes"""
5959
try:
6060
return self.client.swap_indexes(indexes)

src/meilisearch_mcp/keys.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class KeyManager:
99
def __init__(self, client: Client):
1010
self.client = client
1111

12-
async def get_keys(
12+
def get_keys(
1313
self, parameters: Optional[Dict[str, Any]] = None
1414
) -> Dict[str, Any]:
1515
"""Get list of API keys"""
@@ -18,28 +18,28 @@ async def get_keys(
1818
except Exception as e:
1919
raise Exception(f"Failed to get keys: {str(e)}")
2020

21-
async def get_key(self, key: str) -> Dict[str, Any]:
21+
def get_key(self, key: str) -> Dict[str, Any]:
2222
"""Get information about a specific key"""
2323
try:
2424
return self.client.get_key(key)
2525
except Exception as e:
2626
raise Exception(f"Failed to get key: {str(e)}")
2727

28-
async def create_key(self, options: Dict[str, Any]) -> Dict[str, Any]:
28+
def create_key(self, options: Dict[str, Any]) -> Dict[str, Any]:
2929
"""Create a new API key"""
3030
try:
3131
return self.client.create_key(options)
3232
except Exception as e:
3333
raise Exception(f"Failed to create key: {str(e)}")
3434

35-
async def update_key(self, key: str, options: Dict[str, Any]) -> Dict[str, Any]:
35+
def update_key(self, key: str, options: Dict[str, Any]) -> Dict[str, Any]:
3636
"""Update an existing API key"""
3737
try:
3838
return self.client.update_key(key, options)
3939
except Exception as e:
4040
raise Exception(f"Failed to update key: {str(e)}")
4141

42-
async def delete_key(self, key: str) -> None:
42+
def delete_key(self, key: str) -> None:
4343
"""Delete an API key"""
4444
try:
4545
return self.client.delete_key(key)

src/meilisearch_mcp/monitoring.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class MonitoringManager:
3232
def __init__(self, client: Client):
3333
self.client = client
3434

35-
async def get_health_status(self) -> HealthStatus:
35+
def get_health_status(self) -> HealthStatus:
3636
"""Get comprehensive health status"""
3737
try:
3838
# Get various stats to build health picture
@@ -62,7 +62,7 @@ async def get_health_status(self) -> HealthStatus:
6262
except Exception as e:
6363
raise Exception(f"Failed to get health status: {str(e)}")
6464

65-
async def get_index_metrics(self, index_uid: str) -> IndexMetrics:
65+
def get_index_metrics(self, index_uid: str) -> IndexMetrics:
6666
"""Get detailed metrics for an index"""
6767
try:
6868
index = self.client.index(index_uid)
@@ -77,7 +77,7 @@ async def get_index_metrics(self, index_uid: str) -> IndexMetrics:
7777
except Exception as e:
7878
raise Exception(f"Failed to get index metrics: {str(e)}")
7979

80-
async def get_system_information(self) -> Dict[str, Any]:
80+
def get_system_information(self) -> Dict[str, Any]:
8181
"""Get system-level information"""
8282
try:
8383
version = self.client.get_version()

0 commit comments

Comments
 (0)