Skip to main content
Glama

search_logs

Search across fitness logs including workouts, nutrition days, and body metrics to track progress and analyze patterns.

Instructions

Search across workouts, nutrition days, and body metrics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
domainsNo
from_dateNo
to_dateNo
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The implementation of the `search_logs` MCP tool, which performs SQL queries against the 'workouts', 'nutrition_days', and 'body_metrics' tables to search for notes or tags.
    def search_logs(
        query: str,
        domains: Optional[list[str]] = None,
        from_date: Optional[str] = None,
        to_date: Optional[str] = None,
        limit: int = 20,
    ) -> dict[str, list[dict[str, Any]]]:
        """Search across workouts, nutrition days, and body metrics."""
        domains = domains or ["workout", "nutrition", "body"]
        results = []
    
        conn = get_connection()
        cursor = conn.cursor()
    
        if "workout" in domains:
            filters = ["(notes LIKE ? OR workout_type LIKE ? OR tags LIKE ?)"]
            params = [f"%{query}%", f"%{query}%", f"%{query}%"]
            if from_date:
                filters.append("date_time >= ?")
                params.append(f"{_ensure_date(from_date)}T00:00:00")
            if to_date:
                filters.append("date_time <= ?")
                params.append(f"{_ensure_date(to_date)}T23:59:59")
            base = "SELECT * FROM workouts WHERE " + " AND ".join(filters) + " LIMIT ?"
            params.append(limit)
            cursor.execute(base, params)
            for row in cursor.fetchall():
                workout = _hydrate_workout(conn, _row_to_dict(row))
                results.append({"domain": "workout", "workout": workout})
    
        if len(results) >= limit:
            conn.close()
            return {"results": results[:limit]}
    
        remaining = limit - len(results)
    
        if "nutrition" in domains:
            filters = ["(notes LIKE ?)"]
            params = [f"%{query}%"]
            if from_date:
                filters.append("date >= ?")
                params.append(_ensure_date(from_date))
            if to_date:
                filters.append("date <= ?")
                params.append(_ensure_date(to_date))
            base = "SELECT * FROM nutrition_days WHERE " + " AND ".join(filters) + " LIMIT ?"
            params.append(remaining)
            cursor.execute(base, params)
            for row in cursor.fetchall():
                results.append({"domain": "nutrition", "nutrition": _row_to_dict(row)})
    
        if len(results) >= limit:
            conn.close()
            return {"results": results[:limit]}
    
        remaining = limit - len(results)
    
        if "body" in domains:
            filters = ["(notes LIKE ?)"]
            params = [f"%{query}%"]
            if from_date:
                filters.append("date >= ?")
                params.append(_ensure_date(from_date))
            if to_date:
                filters.append("date <= ?")
                params.append(_ensure_date(to_date))
            base = "SELECT * FROM body_metrics WHERE " + " AND ".join(filters) + " LIMIT ?"
            params.append(remaining)
            cursor.execute(base, params)
            for row in cursor.fetchall():
                results.append({"domain": "body", "body": _row_to_dict(row)})
    
        conn.close()
        return {"results": results}
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions what domains are searchable but doesn't describe the search behavior (full-text? partial match?), result format, pagination (though 'limit' parameter exists), error conditions, or authentication requirements. This leaves significant gaps for a search operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise - a single sentence that efficiently communicates the core functionality. Every word earns its place with no redundancy or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (search across multiple domains with 5 parameters), no annotations, but with an output schema present, the description is minimally adequate. The output schema will handle return value documentation, but the description lacks sufficient context about search behavior, parameter usage, and differentiation from sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage and 5 parameters (only 'query' required), the description provides minimal parameter context. It mentions the three searchable domains which somewhat relates to the 'domains' parameter, but doesn't explain parameter purposes, formats (e.g., date format for 'from_date'/'to_date'), or how they interact. The description doesn't adequately compensate for the schema's lack of descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: searching across three specific data types (workouts, nutrition days, and body metrics). It uses a specific verb ('Search') and identifies the resources, but doesn't distinguish this search tool from potential sibling search operations (none exist in the sibling list).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, constraints, or compare it to other tools like 'get_workouts' or 'get_body_metrics' that might retrieve similar data without search functionality.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/JohnZolton/MCP-logger'

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