Skip to content

solidworks_mcp.skills

solidworks_mcp.skills

The agent skill shipped with the server, and the instructions sent at connection.

The skill folder (solidworks-mcp/) is plain files inside the package, so every install has it: the server serves it as skill:// resources, and solidworks-mcp skill install copies it into an agent's skills folder.

Attributes

SERVER_INSTRUCTIONS module-attribute

SERVER_INSTRUCTIONS = 'SolidWorks MCP server: drive SolidWorks parts, assemblies and drawings.\n\n- Start with `get_model_info` (or `list_open_documents`) to see what is open.\n- Build in this order: `create_part`, `create_sketch`, draw (`add_rectangle`, `add_circle`, ...), `exit_sketch`, then the feature (`create_extrusion`, `create_cut_extrude`, `create_revolve`). Features use the sketch `sketch_name` names, or the one you closed last.\n- Fillets and chamfers on a solid go last: `add_fillet` and `add_chamfer` after every boss and cut, at the end of the feature tree.\n- Inputs are millimetres and degrees unless a field says metres.\n- A tool\'s success does not prove the geometry is right: finish a build with `verify_model`, giving the size, volume or counts you expect.\n- A tool whose description starts "Not available yet" returns `not_supported`; use the tool it names instead.\n- On an error, read `error_type` and `hint`; `rebuild_model` names failing features and `undo` steps back.\n\nFull guidance (workflows, selection, units, known limits): read the resource skill://solidworks-mcp/SKILL.md.\n'

SKILL_DIR module-attribute

SKILL_DIR = Path(__file__).parent / SKILL_NAME

SKILL_NAME module-attribute

SKILL_NAME = 'solidworks-mcp'

_SEARCH_MODE module-attribute

_SEARCH_MODE = '\nSearch mode is on: most tools aren\'t listed. Call `search_tools` with what you want to do in plain words ("fillet edges", "save as STEP"); it returns the best matches with their inputs. Run one with `call_tool`, giving its `name` and `arguments`. Search again for each new kind of step.\n'

Functions:

server_instructions

server_instructions(toolsets: tuple[str, ...] = ('all',), mode: str = 'list') -> str

The instructions for the chosen toolsets and tool mode.

Parameters:

Name Type Description Default
toolsets tuple[str, ...]

The toolsets shown, or ("all",).

('all',)
mode str

list or search.

'list'

Returns:

Name Type Description
str str

:data:SERVER_INSTRUCTIONS, plus a line naming the toolsets

str

when some are hidden and a paragraph on searching in search mode.

Source code in src/solidworks_mcp/skills/__init__.py
def server_instructions(
    toolsets: tuple[str, ...] = ("all",), mode: str = "list"
) -> str:
    """The instructions for the chosen toolsets and tool mode.

    Args:
        toolsets: The toolsets shown, or ``("all",)``.
        mode: ``list`` or ``search``.

    Returns:
        str: :data:`SERVER_INSTRUCTIONS`, plus a line naming the toolsets
        when some are hidden and a paragraph on searching in search mode.
    """
    text = SERVER_INSTRUCTIONS
    if "all" not in toolsets:
        text += (
            f"\nOnly these toolsets are on: {', '.join(toolsets)}. Tools from the "
            "others are hidden; the user turns them on with SOLIDWORKS_MCP_TOOLSETS.\n"
        )
    if mode == "search":
        text += _SEARCH_MODE
    return text