Skip to main content
Glama
pzfreo

build123d-mcp

restore_snapshot

Restore the 3D geometry (current_shape and show() registry) to a previously saved snapshot. Python variables remain unchanged, only the model state reverts.

Instructions

Restore geometric state from a previously saved snapshot (current_shape and the show() registry). The Python variable namespace is NOT restored — execute() calls made after the snapshot are still in scope, but current_shape and all show() objects revert to what they were at snapshot time. Raises an error if the snapshot name does not exist.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Core implementation of restore_snapshot in the Session class: validates snapshot exists (raises KeyError if not), then restores current_shape and all objects from the saved snapshot.
    def restore_snapshot(self, name: str) -> None:
        if name not in self.snapshots:
            raise KeyError(f"No snapshot named '{name}'. Available: {list(self.snapshots.keys())}")
        snap = self.snapshots[name]
        self.current_shape = snap["current_shape"]
        self.objects.clear()
        self.objects.update(snap["objects"])
  • Worker dispatch for 'restore_snapshot' op: calls session.restore_snapshot(name), catches KeyError, returns a summary of restored geometry.
    if op == "restore_snapshot":
        name = args["name"]
        try:
            session.restore_snapshot(name)
        except KeyError as e:
            return f"Error: {e}"
        restored = (["current_shape"] if session.current_shape is not None else []) + list(session.objects.keys())
        return f"Snapshot '{name}' restored. Active geometry: {', '.join(restored) if restored else 'none'}."
  • MCP tool registration of restore_snapshot via @mcp.tool() decorator. Defines the tool name, docstring, and delegates to WorkerSession.restore_snapshot.
    @mcp.tool()
    def restore_snapshot(name: str) -> str:
        """Restore geometric state from a previously saved snapshot (current_shape and the show() registry).
        The Python variable namespace is NOT restored — execute() calls made after the snapshot are still in scope,
        but current_shape and all show() objects revert to what they were at snapshot time.
        Raises an error if the snapshot name does not exist."""
        return _session.restore_snapshot(name)
  • Schema/type definition: tool accepts a single 'name: str' parameter.
    @mcp.tool()
    def restore_snapshot(name: str) -> str:
        """Restore geometric state from a previously saved snapshot (current_shape and the show() registry).
        The Python variable namespace is NOT restored — execute() calls made after the snapshot are still in scope,
        but current_shape and all show() objects revert to what they were at snapshot time.
        Raises an error if the snapshot name does not exist."""
        return _session.restore_snapshot(name)
  • WorkerSession proxy method that sends 'restore_snapshot' request to worker subprocess via IPC pipe with short timeout.
    def restore_snapshot(self, name: str) -> str:
        return self._call("restore_snapshot", {"name": name}, self._SHORT_TIMEOUT)
Behavior4/5

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

With no annotations, the description adds value by explaining partial restoration (current_shape and show() revert, but Python namespace persists). It also documents the error if the snapshot does not exist. However, it does not describe side effects like whether the operation is destructive or requires special permissions.

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 three sentences, concise and well-structured. The first sentence states the main purpose, the second clarifies scope limitations, and the third notes an error condition. No redundant information.

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 parameter and no annotations, the description covers core functionality, scope, and error handling. It does not mention return value (but output schema may handle that). It feels complete for a simple restore tool, though adding a note about typical use cases would increase completeness.

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

Parameters3/5

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

Schema description coverage is 0%, so the description must clarify the parameter. It mentions 'snapshot name' in context and links it to existence checking. However, it provides no details on format, validation, or connection to other tools (e.g., 'save_snapshot' creates the snapshot). This is adequate but minimal.

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?

The description clearly states the action: 'Restore geometric state from a previously saved snapshot'. It specifies the exact resources affected (current_shape and show() registry), and explicitly contrasts what is not restored (Python variable namespace). This distinguishes it from sibling tools like 'save_snapshot' and 'diff_snapshot'.

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?

The description explains when to use the tool: to revert geometric state while preserving execute() results. It also notes an error condition. However, it does not explicitly state when not to use it or mention alternative tools, though the context of restoration is clear.

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/pzfreo/build123d-mcp'

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