Skip to main content
Glama

get_parts_list

Retrieve a comprehensive list of parts from the FreeCAD parts library addon to streamline 3D design and assembly processes within the FreeCAD MCP server.

Instructions

Get the list of parts in the parts library addon.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'get_parts_list' that retrieves the list of available parts from the FreeCAD parts library via the RPC connection and returns it as JSON.
    @mcp.tool() def get_parts_list(ctx: Context) -> list[str]: """Get the list of parts in the parts library addon. """ freecad = get_freecad_connection() parts = freecad.get_parts_list() if parts: return [ TextContent(type="text", text=json.dumps(parts)) ] else: return [ TextContent(type="text", text=f"No parts found in the parts library. You must add parts_library addon.") ]
  • Core cached implementation that scans the 'parts_library' directory in FreeCAD's user data for .FCStd files and returns their relative paths.
    @cache def get_parts_list() -> list[str]: parts_lib_path = os.path.join(FreeCAD.getUserAppDataDir(), "Mod", "parts_library") if not os.path.exists(parts_lib_path): raise FileNotFoundError(f"Not found: {parts_lib_path}") parts = [] for root, _, files in os.walk(parts_lib_path): for file in files: if file.endswith(".FCStd"): relative_path = os.path.relpath(os.path.join(root, file), parts_lib_path) parts.append(relative_path) return parts
  • RPC server method that delegates to the parts_library.get_parts_list() function.
    def get_parts_list(self): return get_parts_list()
  • Wrapper method in FreeCADConnection class that calls the RPC server's get_parts_list.
    def get_parts_list(self) -> list[str]: return self.server.get_parts_list()
  • Import of the get_parts_list function from parts_library into the RPC server module.
    from .parts_library import get_parts_list, insert_part_from_library

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