Skip to main content
Glama
neka-nat
by neka-nat

get_object

Retrieve an object and its properties from a FreeCAD document. Specify the document and object names to fetch details and a screenshot for further editing or analysis.

Instructions

Get an object from a document. You can use this tool to get the properties of an object to see what you can check or edit.

Args:
    doc_name: The name of the document to get the object from.
    obj_name: The name of the object to get.

Returns:
    The object and a screenshot of the object.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
doc_nameYes
obj_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for get_object: calls proxy, serializes to JSON, adds screenshot.
    def get_object(ctx: Context, doc_name: str, obj_name: str) -> dict[str, Any]:
        """Get an object from a document.
        You can use this tool to get the properties of an object to see what you can check or edit.
    
        Args:
            doc_name: The name of the document to get the object from.
            obj_name: The name of the object to get.
    
        Returns:
            The object and a screenshot of the object.
        """
        freecad = get_freecad_connection()
        try:
            screenshot = freecad.get_active_screenshot()
            response = [
                TextContent(type="text", text=json.dumps(freecad.get_object(doc_name, obj_name))),
            ]
            return add_screenshot_if_available(response, screenshot)
        except Exception as e:
            logger.error(f"Failed to get object: {str(e)}")
            return [
                TextContent(type="text", text=f"Failed to get object: {str(e)}")
            ]
  • Proxy wrapper in FreeCADConnection for RPC call to get_object.
    def get_object(self, doc_name: str, obj_name: str) -> dict[str, Any]:
        return self.server.get_object(doc_name, obj_name)
  • Core RPC handler: retrieves FreeCAD DocumentObject and serializes it.
    def get_object(self, doc_name, obj_name):
        doc = FreeCAD.getDocument(doc_name)
        if doc:
            return serialize_object(doc.getObject(obj_name))
        else:
            return None
  • Serialization helper that converts FreeCAD objects to JSON-serializable dictionaries, used in get_object RPC.
    def serialize_object(obj):
        if isinstance(obj, list):
            return [serialize_object(item) for item in obj]
        elif isinstance(obj, App.Document):
            return {
                "Name": obj.Name,
                "Label": obj.Label,
                "FileName": obj.FileName,
                "Objects": [serialize_object(child) for child in obj.Objects],
            }
        else:
            result = {
                "Name": obj.Name,
                "Label": obj.Label,
                "TypeId": obj.TypeId,
                "Properties": {},
                "Placement": serialize_value(getattr(obj, "Placement", None)),
                "Shape": serialize_shape(getattr(obj, "Shape", None)),
                "ViewObject": {},
            }
    
            for prop in obj.PropertiesList:
                try:
                    result["Properties"][prop] = serialize_value(getattr(obj, prop))
                except Exception as e:
                    result["Properties"][prop] = f"<error: {str(e)}>"
    
            if hasattr(obj, "ViewObject") and obj.ViewObject is not None:
                view = obj.ViewObject
                result["ViewObject"] = serialize_view_object(view)
    
            return result
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions retrieving an object and its properties, but doesn't disclose behavioral traits like permissions needed, whether this is a read-only operation, potential rate limits, or what happens if the object doesn't exist. The description adds some context about seeing what can be 'checked or edited' but lacks comprehensive behavioral disclosure.

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

Conciseness4/5

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

The description is appropriately sized and well-structured with clear sections for Args and Returns. Each sentence earns its place, though the second sentence could be more concise. The information is front-loaded with the core purpose stated first.

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 2 parameters with no schema descriptions and an output schema exists, the description adequately covers the basics but has gaps. It explains what the tool does and the parameters, but lacks behavioral context (especially important with no annotations) and doesn't fully address sibling tool differentiation. The output schema reduces the need to explain return values in detail.

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

Parameters4/5

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

With 0% schema description coverage, the description compensates by explaining both parameters: 'doc_name: The name of the document to get the object from' and 'obj_name: The name of the object to get'. This adds meaningful semantics beyond the bare schema, though it doesn't provide format examples or constraints.

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: 'Get an object from a document' and 'get the properties of an object', which is a specific verb+resource combination. However, it doesn't explicitly distinguish this tool from its sibling 'get_objects', which appears to be a plural version for retrieving multiple objects.

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 minimal guidance with 'You can use this tool to get the properties of an object to see what you can check or edit', but it doesn't specify when to use this versus alternatives like 'get_objects' or 'get_view'. No explicit when/when-not instructions or prerequisites are mentioned.

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

Related 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/neka-nat/freecad-mcp'

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