Skip to main content
Glama

get_object

Retrieve an object from a FreeCAD document to inspect its properties and view a screenshot for analysis or editing.

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

  • Primary MCP tool handler for 'get_object'. Retrieves object properties via FreeCADConnection proxy, serializes to JSON, adds screenshot if available, and returns as TextContent.
    @mcp.tool()
    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)}")
            ]
  • Helper method in FreeCADConnection class that proxies the get_object RPC call to the XML-RPC server.
    def get_object(self, doc_name: str, obj_name: str) -> dict[str, Any]:
        return self.server.get_object(doc_name, obj_name)
  • Backend RPC server implementation of get_object. Fetches the FreeCAD DocumentObject by name and serializes it using serialize_object.
    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 function used to convert FreeCAD objects to JSON-serializable dicts. (Full function spans multiple lines including recursive serialization.)
    def serialize_object(obj):
        if isinstance(obj, list):
            return [serialize_object(item) for item in obj]
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses that the tool retrieves an object and its properties, and returns a screenshot, which adds useful context about output behavior. However, it lacks details on permissions, error handling, rate limits, or whether this is a read-only operation (though 'get' implies non-destructive). The description doesn't contradict any annotations.

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 well-structured with a purpose statement, usage hint, and sections for Args and Returns. It's front-loaded with the main purpose and avoids unnecessary fluff. However, the usage hint could be more concise, and the structure is slightly verbose for a simple tool.

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 the tool's moderate complexity (2 parameters, no annotations, but has an output schema), the description is reasonably complete. It covers purpose, parameters, and return values (object and screenshot), and the output schema likely details the return structure. However, it could benefit from more behavioral context like error cases or dependencies.

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?

The input schema has 0% description coverage, but the description compensates by explaining the 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 clear meaning beyond the schema's basic titles. However, it doesn't specify format constraints or examples for the names.

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'. It specifies the verb ('get') and resource ('object from a document'), making the intent understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_objects' (plural) or 'get_view', which might retrieve multiple objects or document views instead.

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

Usage Guidelines3/5

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

The description implies usage by stating 'to get the properties of an object to see what you can check or edit', suggesting it's for inspection before potential edits. However, it doesn't provide explicit guidance on when to use this tool versus alternatives like 'get_objects' (for multiple objects) or 'edit_object' (for modifications), nor does it mention prerequisites or exclusions.

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/heok-yongssun/freecad-mcp'

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