Skip to main content
Glama

Write a SchLib

write_schlib
Destructive

Write schematic symbols to an Altium .SchLib file, either creating a new library or appending to an existing one so component libraries can be generated or extended.

Instructions

Write schematic symbols to an Altium .SchLib file (set 'append': true to add to an existing library instead of replacing it). Each symbol is defined by its primitives: pins, rectangles, round_rects, lines, polylines, polygons, arcs, pies, images, text_frames, beziers, ellipses, elliptical_arcs, labels, and text — plus its designator, parameters (Value, Manufacturer, ...) and footprint links ('footprints', name + optional library_path). Multi-part symbols set 'part_count' and tag each pin with 'owner_part_id'. Coordinates must be in schematic units (10 units = 1 grid square, not mm); a pin's (x, y) is its body-attach end and 'orientation' is the direction it points outward — the response echoes each pin's computed body_end and tip. No text field may contain '|', the separator of Altium's record format; Altium's own editor stores it as '¦' (U+00A6).

Input Schema

NameRequiredDescriptionDefault
appendNoIf true, append to existing file; if false, create new file
symbolsYesArray of symbol definitions
filepathYesPath to the .SchLib file to create/modify

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.4.0
    • changedInput schema / properties / symbols / items / properties / pins / items / properties / function_params / description
      Previous value: -"The pin's PinFunctionData entry as read_schlib emitted it, [key, value] string pairs in stored order: the defined functions and what else Altium keeps there, such as the function a schematic selected (PINSELECTEDFUNCTIONSCOUNT, PINSELECTEDFUNCTIONn). It goes back as read while functions is unchanged; edit functions, not this. Pass back unchanged; omit when authoring."New value: +"The pin's PinFunctionData entry as read_schlib emitted it, [key, value] string pairs in stored order. It goes back as read while functions and selected_functions are unchanged; edit those, not this. Pass back unchanged; omit when authoring."
    • addedInput schema / properties / symbols / items / properties / pins / items / properties / selected_functions
      Added value: +{
      +  "description": "The functions preselected for the pin, in order: active on every new placement of the symbol until a schematic picks others (usually some of functions). Altium's own pin dialog cannot set these; a library made from a schematic keeps what it selected. A name may not be empty or contain '|'. Omit for a pin with none.",
      +  "items": {
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
  2. Changed3 schema fields changedv1.3.1
    • changedInput schema / properties / symbols / items / properties / extra_streams / description
      Previous value: -"Streams of the symbol's storage this tool does not model (a PinFunctionData from a newer Altium, say) as [name, base64] pairs, exactly as read_schlib emitted them; written back beside the modelled ones so nothing Altium stored is dropped. Pass back unchanged; omit when authoring."New value: +"Streams of the symbol's storage this tool does not model (a PinTextData, say) as [name, base64] pairs, exactly as read_schlib emitted them; written back beside the modelled ones so nothing Altium stored is dropped. Pass back unchanged; omit when authoring."
    • addedInput schema / properties / symbols / items / properties / pins / items / properties / function_params
      Added value: +{
      +  "description": "The pin's PinFunctionData entry as read_schlib emitted it, [key, value] string pairs in stored order: the defined functions and what else Altium keeps there, such as the function a schematic selected (PINSELECTEDFUNCTIONSCOUNT, PINSELECTEDFUNCTIONn). It goes back as read while functions is unchanged; edit functions, not this. Pass back unchanged; omit when authoring.",
      +  "items": {
      +    "items": {
      +      "type": "string"
      +    },
      +    "maxItems": 2,
      +    "minItems": 2,
      +    "type": "array"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / symbols / items / properties / pins / items / properties / functions
      Added value: +{
      +  "description": "The pin's functions, in order: Altium's Functions property, the peripheral roles a microcontroller pin can take (e.g. [\"PA9\", \"USART1_TX\", \"TIM1_CH2\"]), from which a schematic picks the one it uses. Stored in the symbol's PinFunctionData stream. A name may not be empty or contain '|'. Omit for a pin with none.",
      +  "items": {
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
  3. Changed31 schema fields changedv1.3.0
    • addedInput schema / properties / symbols / items / properties / aliases
      Added value: +{
      +  "description": "Other library references the symbol answers to, as the library header lists them (Altium quotes a name holding a space, e.g. \"CAPACITOR NON-POL\"). Kept on every rewrite. Pass back unchanged; edit to add or remove an alias.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / symbols / items / properties / beziers / items / properties / extra_points
      Added value: +{
      +  "description": "Points past the fourth ({x, y} objects, X5/Y5 onward), as read_schlib emits them for a curve Altium stored with more than four points. Pass back unchanged; omit for a plain cubic.",
      +  "items": {
      +    "properties": {
      +      "x": {
      +        "type": "number"
      +      },
      +      "y": {
      +        "type": "number"
      +      }
      +    },
      +    "required": [
      +      "x",
      +      "y"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / symbols / items / properties / designator_params
      Added value: +{
      +  "description": "The designator record (RECORD=34) segments as [key, value] string pairs in stored order, exactly as read_schlib emitted them: its own FontID, ReadOnlyState, OwnerPartId and Color go back as read, while designator, designator_x/y and designator_unique_id stay editable. Pass back unchanged; omit when authoring (the canonical record is written).",
      +  "items": {
      +    "items": {
      +      "type": "string"
      +    },
      +    "maxItems": 2,
      +    "minItems": 2,
      +    "type": "array"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / symbols / items / properties / footprints / items / properties / datafile_link_records
      Added value: +{
      +  "description": "Text records owned by the link's datafile record (RECORD=46), such as a RECORD=47 pin-map definer, each an array of [key, value] string pairs, as read_schlib emitted them. Pass back unchanged; omit when authoring.",
      +  "items": {
      +    "items": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "maxItems": 2,
      +      "minItems": 2,
      +      "type": "array"
      +    },
      +    "type": "array"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / symbols / items / properties / footprints / items / properties / implementation_records
      Added value: +{
      +  "description": "Text records owned by the link's implementation record (RECORD=48), such as Altium 365's hidden Available Preview Images parameter, each an array of [key, value] string pairs, as read_schlib emitted them. Pass back unchanged; omit when authoring.",
      +  "items": {
      +    "items": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "maxItems": 2,
      +      "minItems": 2,
      +      "type": "array"
      +    },
      +    "type": "array"
      +  },
      +  "type": "array"
      +}
    • changedInput schema / properties / symbols / items / properties / footprints / items / properties / is_current / description
      Previous value: -"Whether this is the current (default) footprint model (IsCurrent=T). Read-preserved; on write the first model is emitted as current. Default: false"New value: +"Whether this is the current (default) model of its type (IsCurrent=T). Read-preserved; when no footprint is current, the first footprint is written as current. Default: false"
    • addedInput schema / properties / symbols / items / properties / footprints / items / properties / model_type
      Added value: +{
      +  "description": "The link's ModelType when it is not a footprint, as read_schlib emitted it: SIM (a simulation model), SI (signal integrity), PCB3DLib (a 3D model). Such a link is carried as Altium stored it and is not a footprint: manage_schlib_footprints add/remove leave it alone. Pass back unchanged; omit for a footprint.",
      +  "type": "string"
      +}
    • changedInput schema / properties / symbols / items / properties / parameters / items / properties / read_only_state / description
      Previous value: -"Read-only state (0=editable, 1=read-only). Default: 0"New value: +"Altium's lock state for the parameter (ReadOnlyState): 0=editable; Altium sets it from the Name and Value Lock options of Parameter Properties, and Altium-authored libraries store 1 and 3. Pass back the value read_schlib reported. Default: 0"
    • changedInput schema / properties / symbols / items / properties / parameters / items / properties / read_only_state / maximum
      Previous value: -1New value: +3
    • addedInput schema / properties / symbols / items / properties / pins / items / properties / owned_records
      Added value: +{
      +  "description": "Text records Altium stores as this pin's children (a pin parameter such as Name=Order), each an array of [key, value] string pairs in stored order, as read_schlib emitted them; written back after the pin with OwnerIndex pointing at it. Pass back unchanged; omit when authoring.",
      +  "items": {
      +    "items": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "maxItems": 2,
      +      "minItems": 2,
      +      "type": "array"
      +    },
      +    "type": "array"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_inner_edge / anyOf
      Added value: +[
      +  {
      +    "enum": [
      +      "none",
      +      "dot",
      +      "right_left_signal_flow",
      +      "clock",
      +      "active_low_input",
      +      "analog_signal_in",
      +      "not_logic_connection",
      +      "shift_right",
      +      "postponed_output",
      +      "open_collector",
      +      "hi_z",
      +      "high_current",
      +      "pulse",
      +      "schmitt",
      +      "delay",
      +      "group_line",
      +      "group_binary",
      +      "active_low_output",
      +      "pi",
      +      "greater_equal",
      +      "less_equal",
      +      "sigma",
      +      "open_collector_pull_up",
      +      "open_emitter",
      +      "open_emitter_pull_up",
      +      "digital_signal_in",
      +      "and",
      +      "invertor",
      +      "or",
      +      "xor",
      +      "shift_left",
      +      "input_output",
      +      "open_output",
      +      "left_right_signal_flow",
      +      "bidirectional_signal_flow"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "maximum": 255,
      +    "minimum": 0,
      +    "type": "integer"
      +  }
      +]
    • removedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_inner_edge / enum
      Removed value: -[
      -  "none",
      -  "dot",
      -  "right_left_signal_flow",
      -  "clock",
      -  "active_low_input",
      -  "analog_signal_in",
      -  "not_logic_connection",
      -  "postponed_output",
      -  "open_collector",
      -  "hi_z",
      -  "high_current",
      -  "pulse",
      -  "schmitt",
      -  "active_low_output",
      -  "open_collector_pull_up",
      -  "open_emitter",
      -  "open_emitter_pull_up",
      -  "digital_signal_in",
      -  "shift_left",
      -  "open_output",
      -  "left_right_signal_flow",
      -  "bidirectional_signal_flow"
      -]
    • addedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_inner_edge / maximum
      Added value: +255
    • addedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_inner_edge / minimum
      Added value: +0
    • changedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_inner_edge / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "integer"
      +]
    • addedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_inside / anyOf
      Added value: +[
      +  {
      +    "enum": [
      +      "none",
      +      "dot",
      +      "right_left_signal_flow",
      +      "clock",
      +      "active_low_input",
      +      "analog_signal_in",
      +      "not_logic_connection",
      +      "shift_right",
      +      "postponed_output",
      +      "open_collector",
      +      "hi_z",
      +      "high_current",
      +      "pulse",
      +      "schmitt",
      +      "delay",
      +      "group_line",
      +      "group_binary",
      +      "active_low_output",
      +      "pi",
      +      "greater_equal",
      +      "less_equal",
      +      "sigma",
      +      "open_collector_pull_up",
      +      "open_emitter",
      +      "open_emitter_pull_up",
      +      "digital_signal_in",
      +      "and",
      +      "invertor",
      +      "or",
      +      "xor",
      +      "shift_left",
      +      "input_output",
      +      "open_output",
      +      "left_right_signal_flow",
      +      "bidirectional_signal_flow"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "maximum": 255,
      +    "minimum": 0,
      +    "type": "integer"
      +  }
      +]
    • removedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_inside / enum
      Removed value: -[
      -  "none",
      -  "dot",
      -  "right_left_signal_flow",
      -  "clock",
      -  "active_low_input",
      -  "analog_signal_in",
      -  "not_logic_connection",
      -  "postponed_output",
      -  "open_collector",
      -  "hi_z",
      -  "high_current",
      -  "pulse",
      -  "schmitt",
      -  "active_low_output",
      -  "open_collector_pull_up",
      -  "open_emitter",
      -  "open_emitter_pull_up",
      -  "digital_signal_in",
      -  "shift_left",
      -  "open_output",
      -  "left_right_signal_flow",
      -  "bidirectional_signal_flow"
      -]
    • addedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_inside / maximum
      Added value: +255
    • addedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_inside / minimum
      Added value: +0
    • changedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_inside / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "integer"
      +]
    • addedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_outer_edge / anyOf
      Added value: +[
      +  {
      +    "enum": [
      +      "none",
      +      "dot",
      +      "right_left_signal_flow",
      +      "clock",
      +      "active_low_input",
      +      "analog_signal_in",
      +      "not_logic_connection",
      +      "shift_right",
      +      "postponed_output",
      +      "open_collector",
      +      "hi_z",
      +      "high_current",
      +      "pulse",
      +      "schmitt",
      +      "delay",
      +      "group_line",
      +      "group_binary",
      +      "active_low_output",
      +      "pi",
      +      "greater_equal",
      +      "less_equal",
      +      "sigma",
      +      "open_collector_pull_up",
      +      "open_emitter",
      +      "open_emitter_pull_up",
      +      "digital_signal_in",
      +      "and",
      +      "invertor",
      +      "or",
      +      "xor",
      +      "shift_left",
      +      "input_output",
      +      "open_output",
      +      "left_right_signal_flow",
      +      "bidirectional_signal_flow"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "maximum": 255,
      +    "minimum": 0,
      +    "type": "integer"
      +  }
      +]
    • removedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_outer_edge / enum
      Removed value: -[
      -  "none",
      -  "dot",
      -  "right_left_signal_flow",
      -  "clock",
      -  "active_low_input",
      -  "analog_signal_in",
      -  "not_logic_connection",
      -  "postponed_output",
      -  "open_collector",
      -  "hi_z",
      -  "high_current",
      -  "pulse",
      -  "schmitt",
      -  "active_low_output",
      -  "open_collector_pull_up",
      -  "open_emitter",
      -  "open_emitter_pull_up",
      -  "digital_signal_in",
      -  "shift_left",
      -  "open_output",
      -  "left_right_signal_flow",
      -  "bidirectional_signal_flow"
      -]
    • addedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_outer_edge / maximum
      Added value: +255
    • addedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_outer_edge / minimum
      Added value: +0
    • changedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_outer_edge / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "integer"
      +]
    • addedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_outside / anyOf
      Added value: +[
      +  {
      +    "enum": [
      +      "none",
      +      "dot",
      +      "right_left_signal_flow",
      +      "clock",
      +      "active_low_input",
      +      "analog_signal_in",
      +      "not_logic_connection",
      +      "shift_right",
      +      "postponed_output",
      +      "open_collector",
      +      "hi_z",
      +      "high_current",
      +      "pulse",
      +      "schmitt",
      +      "delay",
      +      "group_line",
      +      "group_binary",
      +      "active_low_output",
      +      "pi",
      +      "greater_equal",
      +      "less_equal",
      +      "sigma",
      +      "open_collector_pull_up",
      +      "open_emitter",
      +      "open_emitter_pull_up",
      +      "digital_signal_in",
      +      "and",
      +      "invertor",
      +      "or",
      +      "xor",
      +      "shift_left",
      +      "input_output",
      +      "open_output",
      +      "left_right_signal_flow",
      +      "bidirectional_signal_flow"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "maximum": 255,
      +    "minimum": 0,
      +    "type": "integer"
      +  }
      +]
    • changedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_outside / description
      Previous value: -"Decoration drawn outside the pin line, e.g. 'right_left_signal_flow', 'analog_signal_in'. Default: none"New value: +"Decoration drawn outside the pin line, e.g. 'right_left_signal_flow', 'analog_signal_in'. Every slot takes any of Altium's IEEE symbol names, or the stored id (0-255) — read_schlib emits an id past its table as the bare number. Default: none"
    • removedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_outside / enum
      Removed value: -[
      -  "none",
      -  "dot",
      -  "right_left_signal_flow",
      -  "clock",
      -  "active_low_input",
      -  "analog_signal_in",
      -  "not_logic_connection",
      -  "postponed_output",
      -  "open_collector",
      -  "hi_z",
      -  "high_current",
      -  "pulse",
      -  "schmitt",
      -  "active_low_output",
      -  "open_collector_pull_up",
      -  "open_emitter",
      -  "open_emitter_pull_up",
      -  "digital_signal_in",
      -  "shift_left",
      -  "open_output",
      -  "left_right_signal_flow",
      -  "bidirectional_signal_flow"
      -]
    • addedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_outside / maximum
      Added value: +255
    • addedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_outside / minimum
      Added value: +0
    • changedInput schema / properties / symbols / items / properties / pins / items / properties / symbol_outside / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "integer"
      +]
  4. Changed2 schema fields changedv1.2.0
    • addedInput schema / properties / symbols / items / properties / images / items / properties / image_compressed
      Added value: +{
      +  "description": "Set by read_schlib only for an image whose compressed /Storage entry this server would not reproduce (another writer's zlib): the entry exactly as read, reused while it still holds image_data. Pass back unchanged; omit when authoring or replacing an image.",
      +  "type": "string"
      +}
    • addedInput schema / properties / symbols / items / properties / pins / items / properties / name_code_page
      Added value: +{
      +  "description": "Set by read_schlib on a pin a script authored: the ANSI code page its name was widened through, so a rewrite stores the name as Altium did. Pass back unchanged; omit when authoring.",
      +  "enum": [
      +    874,
      +    1250,
      +    1251,
      +    1252,
      +    1253,
      +    1254,
      +    1255,
      +    1256,
      +    1257,
      +    1258
      +  ],
      +  "maximum": 1258,
      +  "minimum": 874,
      +  "type": "integer"
      +}
  5. Changed1 schema field changed
    • addedInput schema / properties / symbols / items / properties / storage_name
      Added value: +{
      +  "description": "The CFB storage the component was read from, as read_pcblib/read_schlib emit it. Pass it back unchanged on a read-modify-write so the component stays where Altium looks for it (Altium re-derives a short name's storage and maps a long one through SectionKeys, so a moved storage is a component it cannot load); omit when authoring or renaming, and the storage name is derived as Altium would: / \\ : ! * become _, then a cut at 31 characters.",
      +  "type": "string"
      +}
  6. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

The annotations declare destructiveHint=true, and the description corroborates and specifies it: append=true adds to the library, while the default replaces it. It adds real operational constraints not in the annotations, notably that coordinates are in schematic units (10 units = 1 grid, not mm), that a pin's (x,y) is the body-attach end, and that '|' is illegal in any text field. It does not describe validation failures or error behavior, keeping it from a 5.

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?

Purpose and the append flag are front-loaded, followed by symbol composition, multi-part handling, coordinates, and the text-separator caveat in a logical order. Dense but nearly every clause carries actionable information; the primitive enumeration is long, though it usefully maps to schema keys.

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?

For a tool whose top level is only three parameters but whose nested schema is enormous, the description covers the highest-risk gotchas (units, pin orientation/anchoring, replacement semantics, illegal characters). With no output schema, it partially compensates by noting the response echoes pin body_end and tip, but does not say what else the write returns or how partial failures surface.

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

Parameters5/5

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

Schema coverage is already 100%, yet the description still adds meaning the schema does not: the 10-units-per-grid rule, the pin inner-end vs tip geometry and the response echoing computed body_end/tip, the part_count/owner_part_id pairing for multi-part symbols, and the '|' separator restriction with Altium's '¦' substitution. These are the mistakes an agent would otherwise make.

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 opens with a specific verb and resource ('Write schematic symbols to an Altium .SchLib file') and immediately scopes the append-vs-replace behavior. The .SchLib target plus the symbol/primitives vocabulary separates it cleanly from write_pcblib and from mutation siblings like update_primitive.

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?

It gives one useful routing rule ('set append: true to add to an existing library instead of replacing it'), but no guidance on when to use this bulk writer versus update_primitive, update_component, batch_update, or validate_library. Read-modify-write usage is implied by the repeated 'pass back unchanged' phrasing in the schema, not stated as guidance here.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.