Skip to main content
Glama

create_routine_folder

Create a new routine folder to organize your workout routines. Returns the folder ID for use when creating routines.

Instructions

Create a new routine folder. Returns the new folder including its id, which you can pass to create_routine as folder_id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The actual handler function for create_routine_folder tool. Accepts a title string, POSTs to Hevy API /routine_folders, and returns created folder data.
    async def create_routine_folder(title: str) -> dict[str, Any]:
        """Create a new routine folder. Returns the new folder including its id, which
        you can pass to `create_routine` as `folder_id`.
        """
        data = await client.post("/routine_folders",
                                  json={"routine_folder": {"title": title}})
        return {"text": f"Folder '{title}' created.", "data": data}
  • Registering of all tool modules via register_all() which calls folders.register(mcp, ctx).
    def register_all(mcp, ctx) -> None:
        workouts.register(mcp, ctx)
        routines.register(mcp, ctx)
        folders.register(mcp, ctx)
        templates.register(mcp, ctx)
        webhooks.register(mcp, ctx)
        analytics.register(mcp, ctx)
  • The register() function that attaches create_routine_folder (and other folder tools) to the MCP server via @mcp.tool() decorator.
    def register(mcp, ctx) -> None:
        client = ctx.client
    
        @mcp.tool()
        @tool_guard
        async def list_routine_folders(page: int = 1, page_size: int = 10) -> dict[str, Any]:
            """List the user's routine folders (e.g. 'Push/Pull/Legs', 'Hypertrophy Block')."""
            return {"data": await client.get("/routine_folders",
                                              params={"page": page, "pageSize": page_size})}
    
        @mcp.tool()
        @tool_guard
        async def get_routine_folder(folder_id: int) -> dict[str, Any]:
            """Fetch a single routine folder by id."""
            return {"data": await client.get(f"/routine_folders/{folder_id}")}
    
        @mcp.tool()
        @tool_guard
        async def create_routine_folder(title: str) -> dict[str, Any]:
            """Create a new routine folder. Returns the new folder including its id, which
            you can pass to `create_routine` as `folder_id`.
            """
            data = await client.post("/routine_folders",
                                      json={"routine_folder": {"title": title}})
            return {"text": f"Folder '{title}' created.", "data": data}
  • The @tool_guard decorator used on create_routine_folder to handle errors uniformly.
    def tool_guard(func: Callable[..., Awaitable[Any]]) -> Callable[..., Awaitable[Any]]:
        """Decorator: convert exceptions into `{error, hint}` and emit structured logs."""
    
        @functools.wraps(func)
        async def wrapper(*args: Any, **kwargs: Any) -> Any:
            start = time.monotonic()
            name = func.__name__
            try:
                result = await func(*args, **kwargs)
                log.info("tool=%s status=ok duration_ms=%.1f", name, (time.monotonic() - start) * 1000)
                return result
            except HevyApiError as e:
                log.warning(
                    "tool=%s status=hevy_error http=%d duration_ms=%.1f msg=%s",
                    name, e.status, (time.monotonic() - start) * 1000, e.message,
                )
                return {"error": e.message, "hint": e.hint, "http_status": e.status}
            except httpx.TimeoutException:
                log.warning("tool=%s status=timeout duration_ms=%.1f", name, (time.monotonic() - start) * 1000)
                return {
                    "error": "Hevy API request timed out.",
                    "hint": "Retry the call. If it keeps timing out, reduce page_size or scope.",
                }
            except ValueError as e:
                log.warning("tool=%s status=bad_input duration_ms=%.1f msg=%s", name, (time.monotonic() - start) * 1000, e)
                return {"error": str(e), "hint": "Re-read the tool's input schema and adjust the arguments."}
            except Exception as e:  # noqa: BLE001 — last-resort guard so Claude never sees a stack trace
                log.exception("tool=%s status=internal_error duration_ms=%.1f", name, (time.monotonic() - start) * 1000)
                return {
                    "error": f"Unexpected internal error: {type(e).__name__}: {e}",
                    "hint": "This is a bug in hevy-mcp. Retry once; if it persists, file an issue with the tool name and inputs.",
                }
    
        return wrapper
  • The HevyClient.post() and request() methods that create_routine_folder uses to make the actual API call.
    # ---- convenience ---- #
    
    async def get(self, path: str, **kw: Any) -> Any:
        return await self.request("GET", path, **kw)
    
    async def post(self, path: str, **kw: Any) -> Any:
        return await self.request("POST", path, **kw)
    
    async def put(self, path: str, **kw: Any) -> Any:
        return await self.request("PUT", path, **kw)
    
    async def delete(self, path: str, **kw: Any) -> Any:
        return await self.request("DELETE", path, **kw)
Behavior3/5

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

No annotations provided; description accurately describes a create operation without side effects, but does not disclose any potential behavior like overwriting or uniqueness constraints. Adequate for a simple 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?

Two sentences, no wasted words, front-loaded with the core action and immediately useful context about the return value.

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

Completeness4/5

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

Given a single required parameter and an output schema, the description adequately covers purpose, return value, and integration with a sibling tool. Lacks minor detail like uniqueness validation but is sufficient.

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?

The only parameter 'title' has no description in the schema, and the tool description does not explain its meaning or constraints. With 0% schema coverage, the description should compensate but fails to do so.

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

Purpose5/5

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

Clearly states the verb 'create' and resource 'routine folder', specifies the return value includes an id, and differentiates from sibling tools by explaining how the returned id is used in create_routine.

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

Usage Guidelines4/5

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

Implicitly suggests using before create_routine by mentioning the returned id as a folder_id parameter, but does not explicitly state when to use or not use this tool versus alternatives.

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/Vellarasan/hevy-mcp'

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