Skip to main content
Glama
Symfomany

Recettes MCP Server

by Symfomany

query_ustensils

Search and retrieve cooking utensils from a recipe database to identify required kitchen tools for meal preparation.

Instructions

Queries the 'ustensils' collection of the 'recipies' MongoDB database.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNo

Implementation Reference

  • main.py:418-427 (handler)
    The asynchronous handler function for the 'query_ustensils' tool. It connects to a local MongoDB instance, queries the 'ustensils' collection in the 'recipies' database with an optional query dict, converts results to JSON-serializable format using _to_jsonable, and returns the list of documents.
    async def query_ustensils(query: Optional[Dict] = None) -> List[Dict]:
        """Interroge la collection 'ustensils' de la base de données MongoDB 'recipies'."""
        client = MongoClient('mongodb://localhost:27017/')
        db = client['recipies']
        collection = db['ustensils']
        query = query or {}
        results = list(collection.find(query))
        client.close()
        
        return [_to_jsonable(doc) for doc in results]
  • main.py:414-417 (registration)
    The @mcp.tool decorator that registers the 'query_ustensils' tool, specifying its name and description.
    @mcp.tool(
        name="query_ustensils",
        description="Queries the 'ustensils' collection of the 'recipies' MongoDB database.",
    )
  • main.py:25-38 (helper)
    Helper utility function used by the 'query_ustensils' handler (and others) to recursively convert MongoDB documents containing ObjectId and datetime objects into JSON-serializable dictionaries.
    def _to_jsonable(doc: Dict[str, any]) -> Dict[str, any]:
        out = {}
        for k, v in doc.items():
            if isinstance(v, ObjectId):
                out[k] = str(v)
            elif isinstance(v, datetime):
                out[k] = v.isoformat()
            elif isinstance(v, dict):
                out[k] = _to_jsonable(v)
            elif isinstance(v, list):
                out[k] = [_to_jsonable(x) if isinstance(x, dict) else x for x in v]
            else:
                out[k] = v
        return out

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/Symfomany/mcp-tuto'

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