added all mcp
This commit is contained in:
20
mealie-mcp-bundle/server/utils.py
Normal file
20
mealie-mcp-bundle/server/utils.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import json
|
||||
|
||||
|
||||
def format_error_response(error_message: str) -> str:
|
||||
"""Format error responses consistently as JSON strings."""
|
||||
error_response = {"success": False, "error": error_message}
|
||||
return json.dumps(error_response)
|
||||
|
||||
|
||||
def format_api_params(params: dict) -> dict:
|
||||
"""Formats list and None values in a dictionary for API parameters."""
|
||||
output = {}
|
||||
for k, v in params.items():
|
||||
if v is None:
|
||||
continue
|
||||
if isinstance(v, list):
|
||||
output[k] = ",".join(v)
|
||||
else:
|
||||
output[k] = v
|
||||
return output
|
||||
Reference in New Issue
Block a user