Skip to main content
Glama
FEAGI MCP Server

FEAGI MCP Server

Official
by feagi

build_circuit_from_spec

Defines a full neural region—areas, morphologies, mappings and template blocks—from one JSON spec, with dry-run validation before any write.

Instructions

Create a region, its areas, morphologies and mappings from one JSON spec.

Spec keys: region ({title, coordinates_2d, coordinates_3d, parent_region_id?} or {region_id}), areas ([{name, dimensions, position?, properties?, psp_uniform?}]), morphologies, mappings ([{src, dst, rules, replace?}]) and templates (expanded in the spec):

  • port: [1,1,N] leaky integrator; threshold, psp, input (and leak, refractory); self-hold mapping sized by threshold - input <= s < threshold.

  • onset_pulse: gate -> <name>_Onset (one burst) via <name>_Delay inhibition.

  • ring_cpg: N-bin ring with self-hold, lateral_psc excitation + wrap, inhibition, drive area, optional seed and shifted readouts; returns predicted_step_bursts flagged uncalibrated: check the period with record_spikes.

  • servo_channel_two_rest: two rest voxels per OPU channel (stance z+1 / z-1) from a tonic area, per-source offset rows with coactive-z compensation, sources inhibiting their own rest neuron. opu must be an existing area driven by a registered agent (its registered coding decides the stance bins; depth must equal its z depth).

  • phase_window_gate: gate area passing pulse to target only while the phase area (phase_bins z bins) is inside window (list or "a..b"); optional tonic enable; out-of-window phase bins inhibit. threshold, leak, accumulate, *_psc/*_psp and inhibit_psc (default sized) are checked: enable alone < T, pulse alone < T (>= T without enable), enable + pulse >= T, enable + pulse - inhibition < T (V <- V (1 - leak) + I, steady state); a violation fails the dry run.

replace (per mapping, default false): a mapping whose source or destination is an existing area keeps the rules already on that edge and appends the spec's rules, so running the same spec twice doubles the rule. Set replace: true to send only the spec's rules (as update_cortical_mapping does), or list the edge under delete first.

psp_uniform (per area) sets neuron_psp_uniform_distribution. Areas keep FEAGI's default (off: PSP is split over fan-out); the result warns when an area with two or more incoming mappings is fed by such areas, since AND-style gates then fail silently.

Memory and plasticity: an area may set cortical_type: "MEMORY" (id must come back with prefix m), memory properties (temporal_depth, neuron_init_lifespan, neuron_lifespan_growth_rate, neuron_longterm_mem_threshold, memory_neuron_cap, ltm_eviction, replay_trigger), mp_encoding (mode or {mode, delta_quantization?, ratio_quantization?}) and modulators ([ids], area-level, e.g. memory.formation). Rules take morphology: episodic_memory (must end in a MEMORY area) or associative_memory (must start in one), and plasticity_mode stdp/rstdp with plasticity_window, plasticity_eta (0..1], max_weight, plasticity_constant, ltp_multiplier/ltd_multiplier, eligibility_decay_bursts (rstdp only; rstdp needs modulators) and delay >= 1. A mapping may carry modulators (applied to rules without their own) and frozen: true (frozen through FEAGI's plasticity_frozen route after its rules are written and read back; flag and mode kept; needs a plastic rule). The freeze is a brain-instance switch, not part of the genome: a genome reload clears it. Illegal mixes fail the dry run.

Ports: ports ({inputs: [area names], outputs: [area names]}) declares the block's interface; a real run writes it to the region's designated_inputs / designated_outputs (PUT /v1/region/region, existing entries kept, read back) and returns created.ports. A direction given in ports replaces the template defaults (port: area in and out; onset_pulse: <name>_Onset out; ring_cpg: ring + readouts out, drive in when it is a spec area; phase_window_gate: gate out). With none declared the result warns "block has no declared ports" and nothing is guessed. Optional port_encoding ({area name: {kind?, signed?, frame?, positioning?}}, declared ports only) sets author entries in the same update; see set_port_encoding.

Also: delete ([{src, dst}]: remove those mappings before the new ones are written) and edit_areas ([{name, properties}] on live areas of region.region_id, which must be an existing region; add areas to it with ordinary areas entries that carry a position).

dry_run (default) validates and returns the full calls list, sizing numbers and external area names it would resolve, without any request. A real run (dry_run=false) aborts before any create on a name conflict, stops at the first failure (no rollback: take snapshot_genome first) and returns created ids plus a verification read (areas found, rules and synapse count per mapping, mappings with zero synapses).

Args: spec_json: The spec as a JSON string dry_run: Only validate and list the calls (default True)

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "spec_json": "<spec_json>"
    },
    "name": "build_circuit_from_spec"
  }
}

Input Schema

NameRequiredDescriptionDefault
dry_runNo
spec_jsonYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.14

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full disclosure burden and does it: dry_run default issues no requests and returns calls/sizing/external names; a real run aborts before any create on name conflict, stops at first failure with no rollback, and returns created ids plus a verification read. It also flags side effects that outlive the call, e.g. frozen plasticity is a brain-instance switch cleared by a genome reload, and illegal mixes fail the dry run.

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

Conciseness3/5

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

The lead sentence is well front-loaded and paragraphs are thematically organized, but the text runs several hundred words with nested constraint chains (e.g. the phase_window_gate voltage check) that read like a spec reference rather than a tool description. Much of it is necessary for this tool's complexity, yet the density makes it harder to scan than it needs to be.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need not be spelled out, and the description still notes what created/verification contain. Given the tool's complexity, it covers prerequisites (existing region for edit_areas, registered agent for opu), failure modes, warnings, and validation behavior, leaving nothing an agent needs to call it correctly.

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 0% (the schema only says 'The spec as a JSON string' and 'Only validate and list the calls'), so the description must compensate and does, enumerating every spec key (region, areas, morphologies, mappings, templates, delete, edit_areas, ports, port_encoding) and the template contracts. It also gives the dry_run default and its effect, which the bare schema only hints at.

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 first sentence names a specific verb and a compound resource: 'Create a region, its areas, morphologies and mappings from one JSON spec.' That singles it out from siblings such as create_brain_region or create_cortical_area, which create single objects, and an agent can tell it builds a whole circuit atomically.

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

Usage Guidelines4/5

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

It states when to run for real versus validate ('dry_run (default) validates... A real run (dry_run=false)...'), warns to take snapshot_genome first because there is no rollback, notes a ring_cpg check with record_spikes, and points to update_cortical_mapping for replace semantics. It never explicitly contrasts itself with create_brain_region, but the 'single spec' framing implies the batch path.

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

Deploy Server

Other Tools