{"at":"2026-11-23T05:01:31.456Z","dir":"sent","era":"server_discover","message":{"id":1,"jsonrpc":"2.0","method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/clientCapabilities":{},"io.modelcontextprotocol/clientInfo":{"name":"didrun-lab","version":"0.1.0"},"io.modelcontextprotocol/protocolVersion":"2026-07-28"}}}}
{"at":"2026-11-23T05:01:34.725Z","dir":"received","era":"server_discover","message":{"id":1,"jsonrpc":"2.0","result":{"_meta":{"io.modelcontextprotocol/serverInfo":{"name":"eeg-realtime","version":"4.2.4"}},"cacheScope":"private","capabilities":{"extensions":{"io.modelcontextprotocol/ui":{}},"logging":{},"prompts":{"listChanged":false},"resources":{"listChanged":false,"subscribe":false},"tools":{"listChanged":false}},"instructions":"Real-time EEG over MCP: stream from hardware, replay recordings against a wall clock, and dispatch stimulation events.\n\nACQUIRE (pick one; both produce a session you query the same way):\n  start_stream   -> live BrainFlow board. Use board='synthetic' to work without hardware.\n  start_replay   -> an existing recording (EDF/BDF/GDF/SET/FIF via MNE, or BrainFlow CSV) played at true recording rate, re-emitting its annotations as events. Develop and test a pipeline here before touching a subject.\n\nTHEN, on that session_id:\n  set_filters            -> stateful online filter chain (do this before reading features; it filters continuously in the background, not per query)\n  read_window            -> raw or filtered samples from the ring buffer\n  get_band_power / get_psd / check_signal_quality -> windowed analytics\n  get_events / log_event -> the unified event log (markers, annotations, and stimulations all land here on one clock)\n  stream_status          -> health, throughput, buffer fill, filter delay\n\nSTIMULATE:\n  list_stim_backends -> what targets exist and which are hardware\n  attach_stim_backend -> bind one to the session ('log' is a safe dry run)\n  arm_stim           -> REQUIRED for hardware (TMS/tES/serial); expires\n  send_stim_event    -> deliver one command; it is logged as an event\n\nTIMING: filters are causal, so features lag by the chain's group delay (reported by stream_status). Add the poll interval and dispatch latency when budgeting a closed loop.\n\nSAFETY: hardware stimulation is disabled unless the server was started with EEG_MCP_ALLOW_HARDWARE_STIM=1, must be armed, and is clamped to configured intensity/duration/interval ceilings. Do not attempt to work around these; ask the operator to configure the server.","resultType":"complete","supportedVersions":["2026-07-28"],"ttlMs":0}}}
{"at":"2026-11-23T05:01:34.725Z","dir":"sent","era":"server_discover","message":{"id":2,"jsonrpc":"2.0","method":"tools/list","params":{"_meta":{"io.modelcontextprotocol/clientCapabilities":{},"io.modelcontextprotocol/protocolVersion":"2026-07-28"}}}}
{"at":"2026-11-23T05:01:34.910Z","dir":"received","era":"server_discover","message":{"id":2,"jsonrpc":"2.0","result":{"_meta":{"io.modelcontextprotocol/serverInfo":{"name":"eeg-realtime","version":"4.2.4"}},"cacheScope":"private","resultType":"complete","tools":[{"_meta":{"fastmcp":{"tags":[]}},"description":"List every board BrainFlow can acquire from, with ids and sampling rates.\n\nStart here when you do not know what hardware is available. Two entries need\nno hardware at all: ``SYNTHETIC_BOARD`` generates a signal for development,\nand ``PLAYBACK_FILE_BOARD`` replays a BrainFlow CSV.","inputSchema":{"additionalProperties":false,"properties":{},"type":"object"},"name":"list_boards","outputSchema":{"additionalProperties":true,"type":"object"},"title":"List Boards"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Open a board and begin buffering EEG in the background.\n\nData flows into a ring buffer from a background thread as soon as this\nreturns, so a subsequent read_window will have samples waiting. The session\nkeeps running until stop_stream is called.","inputSchema":{"additionalProperties":false,"properties":{"board":{"default":"synthetic","description":"Board name ('synthetic', 'cyton', 'muse_2', ...) or numeric id.\nCall list_boards to see the options. Use 'lsl' to attach to an\n*existing* LSL outlet instead of having BrainFlow open the device\nitself -- the route around BrainFlow/SimpleBLE's Windows BLE bug\n(see docs/installation.md troubleshooting): start `muselsl stream`\nor another BLE-to-LSL bridge first, then attach here.","type":"string"},"channels":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"default":null,"description":"Optional subset of EEG row indices (BrainFlow rows, or LSL\nchannel indices when board='lsl'). Defaults to all."},"params":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Connection settings for the chosen board. For BrainFlow boards:\n{\"serial_port\": \"COM3\"} for a Cyton, {\"mac_address\": \"...\"} for a\nMuse, or {\"file\": \"rec.csv\", \"master_board\": \"cyton\"} for\nPLAYBACK_FILE_BOARD. For board='lsl': {\"stream_type\": \"EEG\"}\n(default) or {\"name\": \"...\"} to pick a specific outlet by name,\noptionally {\"resolve_timeout\": 5.0}. BLE-backed outlets can drop\nunpredictably (see docs/hardware.md); by default this source\nwatches for that and reattaches automatically once the bridge\ntool republishes the outlet, logging a `source_reconnected` event\nwith the gap length rather than leaving a silent hole. Tune with\n{\"reconnect\": false} to disable, or {\"stale_after_sec\": 5.0} to\nchange how long with no samples counts as \"disconnected.\""},"session_id":{"description":"Name you will pass to every later call for this stream.","type":"string"}},"required":["session_id"],"type":"object"},"name":"start_stream","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Start Stream"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Stop a stream and release the board, serial ports, and LSL outlets.\n\nAlways call this when finished. A board left prepared can block the next\nprocess from acquiring the device.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The stream to stop.","type":"string"}},"required":["session_id"],"type":"object"},"name":"stop_stream","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Stop Stream"},{"_meta":{"fastmcp":{"tags":[]}},"description":"List all active stream and replay sessions with a one-line summary each.","inputSchema":{"additionalProperties":false,"properties":{},"type":"object"},"name":"list_sessions","outputSchema":{"additionalProperties":true,"type":"object"},"title":"List Sessions"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Health and timing report for a session.\n\nThe fields that matter for closed-loop work:\n``throughput_ratio`` below 1.0 means the producer is not keeping up and\nsamples are being dropped; ``filters.group_delay_sec`` is how far behind\nreal time a filtered feature is; ``last_error`` explains a stopped producer.\nFor an LSL session, ``connection`` reports whether the underlying BLE\nbridge is currently attached, and how many times it has silently\nreconnected -- check ``get_events(origin=\"annotation\")`` for the\n``source_reconnected`` records, which carry each gap's length.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session to report on.","type":"string"}},"required":["session_id"],"type":"object"},"name":"stream_status","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Stream Status"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Read the most recent samples from the buffer.\n\nReturns filtered signal when a filter chain is set (see set_filters),\notherwise raw. Long windows are decimated to ``max_samples`` per channel so\nthe response stays readable -- for numeric work prefer get_band_power or\nget_psd, which compute on the full-resolution data.","inputSchema":{"additionalProperties":false,"properties":{"channels":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"description":"Channel names to include. Defaults to all."},"filtered":{"default":true,"description":"Return the filtered buffer if a chain is set. False for raw.","type":"boolean"},"include_data":{"default":true,"description":"Whether to return the sample arrays at all.","type":"boolean"},"max_samples":{"default":1000,"description":"Decimation cap per channel. Set include_data=False to skip\nthe samples entirely and get only summary statistics.","type":"integer"},"seconds":{"default":2.0,"description":"How much recent signal to return.","type":"number"},"session_id":{"description":"The session to read from.","type":"string"}},"required":["session_id"],"type":"object"},"name":"read_window","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Read Window"},{"_meta":{"fastmcp":{"tags":[]}},"description":"List the channels a session is producing, with their buffer index.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session to inspect.","type":"string"}},"required":["session_id"],"type":"object"},"name":"get_channels","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Get Channels"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Open a recording and describe it without starting playback.\n\nUse this before start_replay to see how long the file is, what channels it\nhas, and which annotations will be re-emitted as events during replay.","inputSchema":{"additionalProperties":false,"properties":{"board":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Required only for BrainFlow CSV, which has no header describing\nits layout (e.g. 'cyton', 'synthetic')."},"max_events":{"default":100,"description":"Cap on how many of the file's events to list.","type":"integer"},"path":{"description":"Absolute path, or a filename inside the configured recordings dir.\nEDF/BDF/GDF/SET/FIF and anything else MNE reads; also BrainFlow CSV.","type":"string"}},"required":["path"],"type":"object"},"name":"inspect_recording","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Inspect Recording"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Replay a recording against a wall clock, re-emitting its events.\n\nThis is the safe way to build a real-time pipeline: the session behaves\nexactly like a live stream -- same buffering, same chunked delivery, same\ntools -- so code developed here runs unchanged against hardware. The\nrecording's annotations arrive in the event log at their original timings.","inputSchema":{"additionalProperties":false,"properties":{"board":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Required only for BrainFlow CSV files."},"loop":{"default":false,"description":"Restart from the beginning on reaching the end, emitting a\n'replay_loop' event each time. Good for long-running rehearsals.","type":"boolean"},"path":{"description":"Absolute path, or a filename inside the configured recordings dir.","type":"string"},"picks":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"MNE channel selection, e.g. 'eeg' or 'mag'. Defaults to EEG."},"session_id":{"description":"Name you will pass to every later call for this session.","type":"string"},"speed":{"default":1.0,"description":"Playback rate. 1.0 is true recording rate; 2.0 is twice as fast;\n0.5 is half. Faster-than-real-time is useful for testing a pipeline\nover a long recording, but stops being a realistic latency test.","type":"number"},"start_sec":{"default":0.0,"description":"Offset into the recording to begin from.","type":"number"},"use_stim_channel":{"default":true,"description":"Also extract events from a hardware trigger channel,\nnot just annotations.","type":"boolean"}},"required":["session_id","path"],"type":"object"},"name":"start_replay","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Start Replay"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Pause, resume, seek, or change the speed of a replay session.","inputSchema":{"additionalProperties":false,"properties":{"action":{"description":"One of 'pause', 'resume', 'seek', 'speed', 'status'.","type":"string"},"position_sec":{"anyOf":[{"type":"number"},{"type":"null"}],"default":null,"description":"Target position, required for action='seek'."},"session_id":{"description":"A session created by start_replay.","type":"string"},"speed":{"anyOf":[{"type":"number"},{"type":"null"}],"default":null,"description":"New playback rate, required for action='speed'."}},"required":["session_id","action"],"type":"object"},"name":"replay_control","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Replay Control"},{"_meta":{"fastmcp":{"tags":[]}},"description":"List all events present in a replay session's source file.\n\nDistinct from get_events: this is the *complete* event list from the file,\nincluding events that have not been reached yet. get_events returns only\nwhat has actually been emitted so far.","inputSchema":{"additionalProperties":false,"properties":{"max_events":{"default":200,"description":"Cap on the number returned.","type":"integer"},"session_id":{"description":"A session created by start_replay.","type":"string"}},"required":["session_id"],"type":"object"},"name":"list_recording_events","outputSchema":{"additionalProperties":true,"type":"object"},"title":"List Recording Events"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Install a stateful online filter chain on a running stream.\n\nThe chain filters continuously in the background as samples arrive, carrying\nfilter state across chunk boundaries. This matters: filtering each query\nwindow independently would inject a transient at every boundary and corrupt\nany phase-sensitive measure. Filtered output goes to a second buffer, so raw\nsignal remains available via read_window(filtered=False).\n\nThese are causal filters -- there is no zero-phase option, because that needs\nfuture samples. Check ``group_delay_sec`` in the response to know how far\nbehind real time your filtered features are.","inputSchema":{"additionalProperties":false,"properties":{"bandpass_high":{"anyOf":[{"type":"number"},{"type":"null"}],"default":40.0,"description":"Low-pass corner in Hz. None to skip the bandpass."},"bandpass_low":{"anyOf":[{"type":"number"},{"type":"null"}],"default":1.0,"description":"High-pass corner in Hz. None to skip the bandpass."},"filters":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"default":null,"description":"Advanced -- an explicit stage list that overrides the arguments\nabove, e.g. [{\"kind\": \"highpass\", \"low\": 0.5},\n{\"kind\": \"notch\", \"low\": 60, \"quality\": 30}].\nKinds: bandpass, bandstop, highpass, lowpass, notch."},"notch_freq":{"anyOf":[{"type":"number"},{"type":"null"}],"default":50.0,"description":"Mains frequency to notch out (50 in most of the world, 60 in\nthe Americas). None to skip."},"order":{"default":4,"description":"Butterworth order for the bandpass. 4 is a sensible default.","type":"integer"},"session_id":{"description":"The session to filter.","type":"string"}},"required":["session_id"],"type":"object"},"name":"set_filters","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Set Filters"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Remove the filter chain; reads return raw signal again.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session to clear filters on.","type":"string"}},"required":["session_id"],"type":"object"},"name":"clear_filters","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Clear Filters"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Band power over the most recent window, per channel and averaged.\n\nThe workhorse feature for neurofeedback and closed-loop triggering. Prefer\nthe ``_rel`` (relative) values for thresholds: they are largely immune to\nimpedance drift, so a threshold set at the start of a session still means\nthe same thing an hour later.","inputSchema":{"additionalProperties":false,"properties":{"bands":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"description":"Band names to compute. Defaults to delta, theta, alpha, beta, gamma."},"channels":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"description":"Channel names to include. Defaults to all."},"filtered":{"default":true,"description":"Use the filtered buffer when a chain is set.","type":"boolean"},"relative":{"default":true,"description":"Also return each band as a fraction of total power.","type":"boolean"},"seconds":{"default":2.0,"description":"Window length. 2 s is a reasonable default; shorter windows are\nnoisier, longer ones respond more slowly.","type":"number"},"session_id":{"description":"The session to analyse.","type":"string"}},"required":["session_id"],"type":"object"},"name":"get_band_power","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Get Band Power"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Power spectral density over the most recent window.\n\nUse when band power is too coarse -- to find a peak alpha frequency, confirm\na stimulation artifact, or check whether a notch actually removed the mains.","inputSchema":{"additionalProperties":false,"properties":{"channels":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"description":"Channel names to include. Defaults to all."},"filtered":{"default":true,"description":"Use the filtered buffer when a chain is set.","type":"boolean"},"fmax":{"default":60.0,"description":"Highest frequency to return.","type":"number"},"max_bins":{"default":120,"description":"Cap on returned frequency bins, to keep the response readable.","type":"integer"},"seconds":{"default":4.0,"description":"Window length. Longer gives finer frequency resolution.","type":"number"},"session_id":{"description":"The session to analyse.","type":"string"}},"required":["session_id"],"type":"object"},"name":"get_psd","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Get Psd"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Per-channel health check: amplitude, flat/railed detection, line noise.\n\nCall this before trusting any real-time feature, and definitely before\ndriving stimulation from one. A flat or railed electrode poisons an\naverage reference and a band-power threshold without changing anything you\nwould notice in the feature value itself.","inputSchema":{"additionalProperties":false,"properties":{"line_freq":{"default":50.0,"description":"Mains frequency to test for (50 or 60).","type":"number"},"seconds":{"default":2.0,"description":"Window length to assess.","type":"number"},"session_id":{"description":"The session to check.","type":"string"}},"required":["session_id"],"type":"object"},"name":"check_signal_quality","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Check Signal Quality"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Record an event against the stream's clock.\n\nFor anything the server did not generate itself: a task onset, a subject\nreport, an experimenter note. Stimulation commands are logged automatically\nby send_stim_event, so do not log those by hand.","inputSchema":{"additionalProperties":false,"properties":{"duration":{"default":0.0,"description":"Event duration in seconds. 0 for an instantaneous event.","type":"number"},"label":{"description":"Event name, e.g. 'trial_start' or 'eyes_closed'.","type":"string"},"mark_in_stream":{"default":true,"description":"Also punch the value into the acquisition stream's own\nmarker channel, so the recording carries the event independently.","type":"boolean"},"payload":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Any extra structured detail to keep with the event."},"session_id":{"description":"The session to annotate.","type":"string"},"value":{"default":1.0,"description":"Numeric code. Also written to the board's marker channel when\nmark_in_stream is set; BrainFlow reserves 0, so use a nonzero value.","type":"number"}},"required":["session_id","label"],"type":"object"},"name":"log_event","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Log Event"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Read the session's event log.\n\nEverything lands here on one clock: board markers, annotations re-emitted by\na replay, stimulation commands we dispatched, and manual notes. That is what\nmakes a closed-loop run reconstructible afterwards without joining clocks.","inputSchema":{"additionalProperties":false,"properties":{"label":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Filter to one event label."},"last_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"default":null,"description":"Only events from the last N seconds. None for all."},"limit":{"default":200,"description":"Maximum events to return, most recent first-truncated.","type":"integer"},"origin":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Filter by 'marker' (live board), 'annotation' (from a replayed\nfile), 'stim' (dispatched by us), or 'manual' (logged by hand)."},"session_id":{"description":"The session to read.","type":"string"}},"required":["session_id"],"type":"object"},"name":"get_events","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Get Events"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Extract the signal window around an event that already occurred.\n\nOnline epoching: use it to inspect the response to the most recent stimulus,\nor to verify that a stimulation artifact lands where you expect. The event\nmust still be inside the ring buffer -- for a default 60 s buffer, that means\nwithin the last minute.","inputSchema":{"additionalProperties":false,"properties":{"filtered":{"default":true,"description":"Use the filtered buffer when a chain is set.","type":"boolean"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Event label to find. None takes the most recent event of any kind."},"max_samples":{"default":500,"description":"Decimation cap per channel.","type":"integer"},"occurrence":{"default":-1,"description":"Which matching event; -1 is the most recent, -2 the one\nbefore it, 0 the earliest still in the log.","type":"integer"},"session_id":{"description":"The session to read from.","type":"string"},"tmax":{"default":0.8,"description":"Window end relative to the event, in seconds.","type":"number"},"tmin":{"default":-0.2,"description":"Window start relative to the event, in seconds (negative = before).","type":"number"}},"required":["session_id"],"type":"object"},"name":"get_epoch_around_event","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Get Epoch Around Event"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Empty the session's event log without stopping the stream.\n\nUseful between blocks of an experiment. The signal buffer is untouched.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session whose log to clear.","type":"string"}},"required":["session_id"],"type":"object"},"name":"clear_events","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Clear Events"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Fold an external LSL marker stream into this session's event log.\n\nThe reverse of attach_stim_backend(backend=\"lsl\"): that publishes markers\nfor other software to consume; this consumes markers *from* other\nsoftware -- PsychoPy is the common case, but anything that timestamps its\nown events over LSL works the same way. Each marker lands with\norigin='marker' at the sample index nearest its own LSL timestamp in the\nraw buffer, the same \"one event log, one clock\" treatment a board's own\nmarker channel gets.\n\nOnly one marker stream can be attached per session; attaching again\nreplaces the previous one.","inputSchema":{"additionalProperties":false,"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Resolve by outlet name instead, to pick one of several."},"resolve_timeout":{"default":5.0,"description":"Seconds to wait for the outlet before failing.","type":"number"},"session_id":{"description":"The session to annotate.","type":"string"},"stream_type":{"default":"Markers","description":"LSL type to resolve by. 'Markers' matches what PsychoPy\nand most LSL marker outlets (including this server's own\nattach_stim_backend(backend=\"lsl\")) declare by convention.","type":"string"}},"required":["session_id"],"type":"object"},"name":"attach_marker_stream","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Attach Marker Stream"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Stop listening for external markers on this session.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session to detach from.","type":"string"}},"required":["session_id"],"type":"object"},"name":"detach_marker_stream","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Detach Marker Stream"},{"_meta":{"fastmcp":{"tags":[]}},"description":"List stimulation targets, their options, and which ones drive hardware.\n\nSoftware backends ('log', 'lsl', 'brainflow_marker') are always available.\nHardware backends ('serial_ttl', 'tms', 'tes', 'template_serial') require\nthe server to have been started with EEG_MCP_ALLOW_HARDWARE_STIM=1, and must\nbe armed before each session of use.","inputSchema":{"additionalProperties":false,"properties":{},"type":"object"},"name":"list_stim_backends","outputSchema":{"additionalProperties":true,"type":"object"},"title":"List Stim Backends"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Bind a stimulation target to a session and open its transport.\n\nStart with backend='log' to rehearse a protocol with no output at all, then\nswitch once the timing looks right.","inputSchema":{"additionalProperties":false,"properties":{"backend":{"default":"log","description":"One of the names from list_stim_backends.","type":"string"},"make_default":{"default":true,"description":"Use this backend when send_stim_event omits one.","type":"boolean"},"options":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Backend-specific settings. For serial backends: {\"port\": \"COM3\"}.\nFor templated devices (tms, tes, template_serial), the commands from\nyour device manual, e.g.\n{\"port\": \"COM3\", \"templates\": {\"fire\": \"TRIG\\r\\n\",\n \"set_intensity\": \"AMP {intensity:.0f}\\r\\n\"}}."},"session_id":{"description":"The session to attach to.","type":"string"}},"required":["session_id"],"type":"object"},"name":"attach_stim_backend","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Attach Stim Backend"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Close and remove a stimulation backend from a session.","inputSchema":{"additionalProperties":false,"properties":{"backend":{"description":"The attached backend's name.","type":"string"},"session_id":{"description":"The session to detach from.","type":"string"}},"required":["session_id","backend"],"type":"object"},"name":"detach_stim_backend","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Detach Stim Backend"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Permit hardware stimulation for a bounded window.\n\nArming expires deliberately: an agent that stalls mid-protocol should not be\nable to resume and fire a stimulator minutes later without a fresh, explicit\ndecision. Re-arm as needed, or disarm the moment a block ends.","inputSchema":{"additionalProperties":false,"properties":{"backend":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Which attached backend. Defaults to the session default."},"session_id":{"description":"The session whose backend to arm.","type":"string"},"ttl_sec":{"default":300.0,"description":"How long the arming lasts, in seconds.","type":"number"}},"required":["session_id"],"type":"object"},"name":"arm_stim","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Arm Stim"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Revoke permission to stimulate. Takes effect immediately.","inputSchema":{"additionalProperties":false,"properties":{"backend":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Which attached backend. Defaults to the session default."},"session_id":{"description":"The session whose backend to disarm.","type":"string"}},"required":["session_id"],"type":"object"},"name":"disarm_stim","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Disarm Stim"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Deliver one stimulation command, and log it against the EEG clock.\n\nThe event is written to the session log whether the transport succeeds or\nfails -- a failed stimulation attempt matters just as much to the record.\nWhen the acquisition source supports markers, the same event is also punched\ninto the stream itself so the recording is self-describing.","inputSchema":{"additionalProperties":false,"properties":{"also_mark_source":{"default":true,"description":"Also write the code into the acquisition stream's own\nmarker channel.","type":"boolean"},"backend":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Which attached backend to use. Defaults to the session default."},"duration_ms":{"default":0.0,"description":"Pulse width or stimulation duration.","type":"number"},"intensity":{"anyOf":[{"type":"number"},{"type":"null"}],"default":null,"description":"Physical dose for hardware backends -- %MSO for TMS, mA for\ntES. Clamped against the configured ceiling; ignored by software\nbackends."},"kind":{"default":"marker","description":"'marker' (event code only), 'pulse' (code then clear after\nduration_ms), 'train', 'ramp', or 'custom'. Backends advertise which\nkinds they support via list_stim_backends.","type":"string"},"label":{"description":"Event name, e.g. 'tms_pulse' or 'cue_left'.","type":"string"},"params":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Extra fields made available to command templates."},"session_id":{"description":"The session to stimulate within.","type":"string"},"target":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Coil, montage or channel identifier, for the record."},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Unit label for intensity, for the record."},"value":{"default":1.0,"description":"Numeric code for marker streams and trigger lines. Nonzero.","type":"number"}},"required":["session_id","label"],"type":"object"},"name":"send_stim_event","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Send Stim Event"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Deliver a regular train of pulses, blocking until it completes.\n\nFor rTMS bursts and repeated cues. The call holds until the train finishes,\nso it is capped at 1000 pulses and 60 seconds total; build longer protocols\nfrom several calls so there are decision points in between.\n\nEvery pulse is logged individually, so the event log reconstructs the exact\ndelivered timing rather than the intended timing.","inputSchema":{"additionalProperties":false,"properties":{"backend":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Which attached backend. Defaults to the session default."},"duration_ms":{"default":0.0,"description":"Pulse width.","type":"number"},"intensity":{"anyOf":[{"type":"number"},{"type":"null"}],"default":null,"description":"Physical dose per pulse, clamped against the ceiling."},"interval_ms":{"description":"Inter-pulse interval. For rTMS this is 1000/frequency.","type":"number"},"label":{"description":"Base event name; pulses are logged as '<label>_<n>'.","type":"string"},"n_pulses":{"description":"How many pulses to deliver.","type":"integer"},"session_id":{"description":"The session to stimulate within.","type":"string"},"value":{"default":1.0,"description":"Numeric code for each pulse.","type":"number"}},"required":["session_id","label","n_pulses","interval_ms"],"type":"object"},"name":"send_stim_train","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Send Stim Train"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Report attached stimulation backends, arming state, and dispatch counts.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session to report on.","type":"string"}},"required":["session_id"],"type":"object"},"name":"stim_status","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Stim Status"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Open a live browser view of a running session and return its URL.\n\nServes a rolling traces view with event markers, band power and per-channel\nquality, refreshing continuously. This is the tool for \"let me watch the\nrecording\" -- a static plot cannot answer whether the signal is good *now*.\n\nWith ``allow_control`` (the default) the page also carries transport\nbuttons: play/pause, restart, skip, speed, stop, mark an event, and save a\nreport. Pass ``allow_control=false`` for a strictly read-only view, e.g.\nwhen showing the screen to someone who should not be able to alter the run.\n\nThe page is bound to 127.0.0.1 only and requires a random per-monitor token,\nso it is not reachable from the network. It is still unencrypted: do not\nexpose it through a tunnel or reverse proxy.","inputSchema":{"additionalProperties":false,"properties":{"allow_control":{"default":true,"description":"Enable the transport buttons and the control endpoint.","type":"boolean"},"port":{"default":0,"description":"TCP port on loopback. 0 lets the OS choose a free one.","type":"integer"},"refresh_ms":{"default":500,"description":"Redraw interval. 500 ms is smooth without loading the server.","type":"integer"},"session_id":{"description":"The running session to display.","type":"string"},"window_sec":{"default":5.0,"description":"Seconds of signal shown at once. Adjustable in the page too.","type":"number"}},"required":["session_id"],"type":"object"},"name":"start_monitor","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Start Monitor"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Close a session's live monitor and free its port.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session whose monitor to stop.","type":"string"}},"required":["session_id"],"type":"object"},"name":"stop_monitor","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Stop Monitor"},{"_meta":{"fastmcp":{"tags":[]}},"description":"List live monitors currently serving, with their URLs.","inputSchema":{"additionalProperties":false,"properties":{},"type":"object"},"name":"list_monitors","outputSchema":{"additionalProperties":true,"type":"object"},"title":"List Monitors"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Render the recent signal as a standalone HTML file and return its path.\n\nA frozen snapshot, unlike start_monitor -- use it to keep a record, attach to\na note, or share. The file inlines everything and needs no internet.","inputSchema":{"additionalProperties":false,"properties":{"channels":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"description":"Channel names to include. Defaults to all."},"filtered":{"default":true,"description":"Draw the filtered signal when a chain is set.","type":"boolean"},"seconds":{"default":10.0,"description":"How much recent signal to draw.","type":"number"},"session_id":{"description":"The session to plot.","type":"string"},"show_events":{"default":true,"description":"Overlay event markers on the traces.","type":"boolean"}},"required":["session_id"],"type":"object"},"name":"plot_stream","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Plot Stream"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Render the power spectrum and band composition as a standalone HTML file.","inputSchema":{"additionalProperties":false,"properties":{"channels":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"description":"Channel names to include. Defaults to all."},"filtered":{"default":true,"description":"Use the filtered signal when a chain is set.","type":"boolean"},"fmax":{"default":60.0,"description":"Highest frequency to draw.","type":"number"},"seconds":{"default":8.0,"description":"Window length. Longer gives finer frequency resolution.","type":"number"},"session_id":{"description":"The session to analyse.","type":"string"}},"required":["session_id"],"type":"object"},"name":"plot_spectrum","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Plot Spectrum"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Write a full review page: traces, spectrum, quality, and the event log.\n\nThe one artefact to keep from a session. Everything is inlined, so it opens\non any machine, needs no internet, and still renders years from now.","inputSchema":{"additionalProperties":false,"properties":{"include_spectrum":{"default":true,"description":"Add the PSD and band-power sections.","type":"boolean"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Free text to record at the top -- indication, montage, observations."},"seconds":{"default":10.0,"description":"Window of signal to include in the traces and spectrum.","type":"number"},"session_id":{"description":"The session to report on.","type":"string"}},"required":["session_id"],"type":"object"},"name":"export_report","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Export Report"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Begin writing the live signal to disk, continuously.\n\nCall this as soon as the session starts if you intend to keep the data. The\nring buffer only holds the last minute or so, so anything not recorded is\ngone -- a session streamed for an hour without recording leaves nothing but\nwhatever reports you exported.\n\nThe raw, unfiltered signal is written. Filter settings are stored alongside\nit so a filtered view is reproducible; the amplifier's actual output is not\nreconstructible from anything else.","inputSchema":{"additionalProperties":false,"properties":{"dataset":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Study or collection name that groups recordings together."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Explicit filename stem, overriding the BIDS-style name built from\nsubject/session/task/run."},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Free text kept with the recording."},"run":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Run number within the task, e.g. '01'."},"session_id":{"description":"The running session to record.","type":"string"},"session_label":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Visit or session label, e.g. '01' or 'baseline'."},"subject":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Participant identifier, e.g. 'sub-04' or a study code. Becomes\nthe subject row in the metadata store. Avoid direct identifiers."},"task":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"What the participant is doing, e.g. 'rest', 'motor-imagery'."}},"required":["session_id"],"type":"object"},"name":"start_recording","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Start Recording"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Finish the recording, write the ``.fif``, and register it for analysis.\n\nThe event log becomes annotations inside the file, and -- unless you pass\n``register=false`` -- a row is inserted into the metadata store with the\nsubject, task, run and provenance, so neuro-mcp can find and open it.","inputSchema":{"additionalProperties":false,"properties":{"keep_sidecar":{"default":false,"description":"Keep the raw crash-recovery files after conversion.\nNormally removed once the .fif is safely written.","type":"boolean"},"register":{"default":true,"description":"Insert the recording into the metadata database.","type":"boolean"},"session_id":{"description":"The session whose recording to finish.","type":"string"}},"required":["session_id"],"type":"object"},"name":"stop_recording","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Stop Recording"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Report whether a session is recording, and how much has been written.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session to check.","type":"string"}},"required":["session_id"],"type":"object"},"name":"recording_status","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Recording Status"},{"_meta":{"fastmcp":{"tags":[]}},"description":"List recordings in eeg-mcp's own metadata store, newest first.\n\nThis store belongs to eeg-mcp alone. Analysis tools read from it -- the\nschema is compatible with neuro-mcp's, so it can open this database and\nunderstand every row -- but nothing else writes to it.","inputSchema":{"additionalProperties":false,"properties":{"limit":{"default":25,"description":"Maximum number to return.","type":"integer"},"subject":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Only recordings for this participant identifier."}},"type":"object"},"name":"list_recordings","outputSchema":{"additionalProperties":true,"type":"object"},"title":"List Recordings"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Finish a recording whose process died before it could be closed.\n\nSamples are appended to disk as they arrive and the header is written up\nfront, precisely so an interrupted session is not lost. Point this at the\norphaned ``.eegmcp.json`` header to convert what was captured into a ``.fif``.\n\nEvents are not recoverable -- they lived in memory -- so the resulting file\ncarries signal without annotations.","inputSchema":{"additionalProperties":false,"properties":{"header_path":{"description":"Path to the ``<stem>.eegmcp.json`` left behind.","type":"string"},"keep_sidecar":{"default":false,"description":"Keep the raw files after conversion.","type":"boolean"}},"required":["header_path"],"type":"object"},"name":"recover_recording","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Recover Recording"},{"_meta":{"fastmcp":{"tags":[]}},"description":"List real-time processors available to attach, and where they came from.\n\nBuilt-ins are always present. Your own appear here once the **server**\nenvironment points at them -- via the ``eeg_mcp.processors`` entry point,\n``EEG_MCP_PLUGINS``, or ``EEG_MCP_PLUGIN_DIR``. They cannot be loaded from a\ntool call, because importing a module executes it and that would make\narbitrary code execution reachable from a model.","inputSchema":{"additionalProperties":false,"properties":{},"type":"object"},"name":"list_processors","outputSchema":{"additionalProperties":true,"type":"object"},"title":"List Processors"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Attach a processor to a session.\n\nA ``streaming`` processor runs inside the acquisition loop on every chunk,\nso it reacts within one poll interval without an agent round-trip -- that is\nhow closed-loop logic gets fast. The cost is that slow code stalls\nacquisition; ``processor_status`` reports each one's mean and worst-case\ntime so you can see whether yours is affordable.\n\nNon-streaming processors do nothing until you call ``run_processor``.","inputSchema":{"additionalProperties":false,"properties":{"params":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Processor-specific settings; see its ``params`` in the listing."},"processor":{"description":"Name from list_processors.","type":"string"},"session_id":{"description":"The session to attach to.","type":"string"}},"required":["session_id","processor"],"type":"object"},"name":"attach_processor","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Attach Processor"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Remove a processor from a session and release its state.","inputSchema":{"additionalProperties":false,"properties":{"processor":{"description":"The attached processor's name.","type":"string"},"session_id":{"description":"The session to detach from.","type":"string"}},"required":["session_id","processor"],"type":"object"},"name":"detach_processor","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Detach Processor"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Report attached processors, their health, and their cost.\n\n``mean_ms`` and ``max_ms`` are the numbers to watch for a streaming\nprocessor: if ``max_ms`` approaches the poll interval (50 ms by default) it\nis starving acquisition, which shows up as ``throughput_ratio`` below 1.0 in\nstream_status. A processor that raises 10 times is disabled automatically\nrather than being retried forever inside the producer loop.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session to report on.","type":"string"}},"required":["session_id"],"type":"object"},"name":"processor_status","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Processor Status"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Read a streaming processor's recent outputs.","inputSchema":{"additionalProperties":false,"properties":{"limit":{"default":20,"description":"How many recent outputs to return, newest last.","type":"integer"},"processor":{"description":"The attached processor's name.","type":"string"},"session_id":{"description":"The session to read from.","type":"string"}},"required":["session_id","processor"],"type":"object"},"name":"get_processor_output","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Get Processor Output"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Run a processor once on the most recent window, on demand.\n\nWorks for both modes: for a non-streaming processor this is the only way to\nexecute it, and for a streaming one it is a way to get an answer right now\nrather than waiting for its next scheduled output.","inputSchema":{"additionalProperties":false,"properties":{"filtered":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":null,"description":"Override the processor's declared preference for filtered or\nraw signal."},"processor":{"description":"The attached processor's name.","type":"string"},"seconds":{"default":2.0,"description":"Window length to pass in.","type":"number"},"session_id":{"description":"The session to read from.","type":"string"}},"required":["session_id","processor"],"type":"object"},"name":"run_processor","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Run Processor"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Clear accumulated processor state and outputs, without detaching them.\n\nUseful between experimental blocks, and after a replay seek, so a rolling\nwindow does not straddle the discontinuity.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session whose processors to reset.","type":"string"}},"required":["session_id"],"type":"object"},"name":"reset_processors","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Reset Processors"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Read discrete tokens from a tokenizing processor.\n\nFor feeding EEG into sequence models. Returns both the grouped tokens (one\ngroup per window) and a flat sequence, plus the vocabulary size and the\nchannel/band layout each position corresponds to.\n\nWorks with any attached processor exposing ``token_history`` -- the built-in\n``band_tokenizer`` is a starting point, and your own tokenizer plugs in the\nsame way.","inputSchema":{"additionalProperties":false,"properties":{"limit":{"default":32,"description":"How many recent token groups to return.","type":"integer"},"processor":{"default":"band_tokenizer","description":"The tokenizing processor's name.","type":"string"},"session_id":{"description":"The session to read from.","type":"string"}},"required":["session_id"],"type":"object"},"name":"get_tokens","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Get Tokens"}],"ttlMs":0}}}
{"at":"2026-11-23T05:01:35.262Z","dir":"sent","era":"initialize","message":{"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{},"clientInfo":{"name":"didrun-lab","version":"0.1.0"},"protocolVersion":"2025-11-25"}}}
{"at":"2026-11-23T05:01:38.495Z","dir":"received","era":"initialize","message":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"logging":{},"prompts":{"listChanged":true},"resources":{"listChanged":true,"subscribe":false},"tools":{"listChanged":true}},"instructions":"Real-time EEG over MCP: stream from hardware, replay recordings against a wall clock, and dispatch stimulation events.\n\nACQUIRE (pick one; both produce a session you query the same way):\n  start_stream   -> live BrainFlow board. Use board='synthetic' to work without hardware.\n  start_replay   -> an existing recording (EDF/BDF/GDF/SET/FIF via MNE, or BrainFlow CSV) played at true recording rate, re-emitting its annotations as events. Develop and test a pipeline here before touching a subject.\n\nTHEN, on that session_id:\n  set_filters            -> stateful online filter chain (do this before reading features; it filters continuously in the background, not per query)\n  read_window            -> raw or filtered samples from the ring buffer\n  get_band_power / get_psd / check_signal_quality -> windowed analytics\n  get_events / log_event -> the unified event log (markers, annotations, and stimulations all land here on one clock)\n  stream_status          -> health, throughput, buffer fill, filter delay\n\nSTIMULATE:\n  list_stim_backends -> what targets exist and which are hardware\n  attach_stim_backend -> bind one to the session ('log' is a safe dry run)\n  arm_stim           -> REQUIRED for hardware (TMS/tES/serial); expires\n  send_stim_event    -> deliver one command; it is logged as an event\n\nTIMING: filters are causal, so features lag by the chain's group delay (reported by stream_status). Add the poll interval and dispatch latency when budgeting a closed loop.\n\nSAFETY: hardware stimulation is disabled unless the server was started with EEG_MCP_ALLOW_HARDWARE_STIM=1, must be armed, and is clamped to configured intensity/duration/interval ceilings. Do not attempt to work around these; ask the operator to configure the server.","protocolVersion":"2025-11-25","serverInfo":{"name":"eeg-realtime","version":"4.2.4"}}}}
{"at":"2026-11-23T05:01:38.495Z","dir":"sent","era":"initialize","message":{"jsonrpc":"2.0","method":"notifications/initialized"}}
{"at":"2026-11-23T05:01:38.495Z","dir":"sent","era":"initialize","message":{"id":2,"jsonrpc":"2.0","method":"tools/list","params":{}}}
{"at":"2026-11-23T05:01:38.684Z","dir":"received","era":"initialize","message":{"id":2,"jsonrpc":"2.0","result":{"tools":[{"_meta":{"fastmcp":{"tags":[]}},"description":"List every board BrainFlow can acquire from, with ids and sampling rates.\n\nStart here when you do not know what hardware is available. Two entries need\nno hardware at all: ``SYNTHETIC_BOARD`` generates a signal for development,\nand ``PLAYBACK_FILE_BOARD`` replays a BrainFlow CSV.","inputSchema":{"additionalProperties":false,"properties":{},"type":"object"},"name":"list_boards","outputSchema":{"additionalProperties":true,"type":"object"},"title":"List Boards"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Open a board and begin buffering EEG in the background.\n\nData flows into a ring buffer from a background thread as soon as this\nreturns, so a subsequent read_window will have samples waiting. The session\nkeeps running until stop_stream is called.","inputSchema":{"additionalProperties":false,"properties":{"board":{"default":"synthetic","description":"Board name ('synthetic', 'cyton', 'muse_2', ...) or numeric id.\nCall list_boards to see the options. Use 'lsl' to attach to an\n*existing* LSL outlet instead of having BrainFlow open the device\nitself -- the route around BrainFlow/SimpleBLE's Windows BLE bug\n(see docs/installation.md troubleshooting): start `muselsl stream`\nor another BLE-to-LSL bridge first, then attach here.","type":"string"},"channels":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"default":null,"description":"Optional subset of EEG row indices (BrainFlow rows, or LSL\nchannel indices when board='lsl'). Defaults to all."},"params":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Connection settings for the chosen board. For BrainFlow boards:\n{\"serial_port\": \"COM3\"} for a Cyton, {\"mac_address\": \"...\"} for a\nMuse, or {\"file\": \"rec.csv\", \"master_board\": \"cyton\"} for\nPLAYBACK_FILE_BOARD. For board='lsl': {\"stream_type\": \"EEG\"}\n(default) or {\"name\": \"...\"} to pick a specific outlet by name,\noptionally {\"resolve_timeout\": 5.0}. BLE-backed outlets can drop\nunpredictably (see docs/hardware.md); by default this source\nwatches for that and reattaches automatically once the bridge\ntool republishes the outlet, logging a `source_reconnected` event\nwith the gap length rather than leaving a silent hole. Tune with\n{\"reconnect\": false} to disable, or {\"stale_after_sec\": 5.0} to\nchange how long with no samples counts as \"disconnected.\""},"session_id":{"description":"Name you will pass to every later call for this stream.","type":"string"}},"required":["session_id"],"type":"object"},"name":"start_stream","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Start Stream"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Stop a stream and release the board, serial ports, and LSL outlets.\n\nAlways call this when finished. A board left prepared can block the next\nprocess from acquiring the device.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The stream to stop.","type":"string"}},"required":["session_id"],"type":"object"},"name":"stop_stream","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Stop Stream"},{"_meta":{"fastmcp":{"tags":[]}},"description":"List all active stream and replay sessions with a one-line summary each.","inputSchema":{"additionalProperties":false,"properties":{},"type":"object"},"name":"list_sessions","outputSchema":{"additionalProperties":true,"type":"object"},"title":"List Sessions"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Health and timing report for a session.\n\nThe fields that matter for closed-loop work:\n``throughput_ratio`` below 1.0 means the producer is not keeping up and\nsamples are being dropped; ``filters.group_delay_sec`` is how far behind\nreal time a filtered feature is; ``last_error`` explains a stopped producer.\nFor an LSL session, ``connection`` reports whether the underlying BLE\nbridge is currently attached, and how many times it has silently\nreconnected -- check ``get_events(origin=\"annotation\")`` for the\n``source_reconnected`` records, which carry each gap's length.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session to report on.","type":"string"}},"required":["session_id"],"type":"object"},"name":"stream_status","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Stream Status"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Read the most recent samples from the buffer.\n\nReturns filtered signal when a filter chain is set (see set_filters),\notherwise raw. Long windows are decimated to ``max_samples`` per channel so\nthe response stays readable -- for numeric work prefer get_band_power or\nget_psd, which compute on the full-resolution data.","inputSchema":{"additionalProperties":false,"properties":{"channels":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"description":"Channel names to include. Defaults to all."},"filtered":{"default":true,"description":"Return the filtered buffer if a chain is set. False for raw.","type":"boolean"},"include_data":{"default":true,"description":"Whether to return the sample arrays at all.","type":"boolean"},"max_samples":{"default":1000,"description":"Decimation cap per channel. Set include_data=False to skip\nthe samples entirely and get only summary statistics.","type":"integer"},"seconds":{"default":2.0,"description":"How much recent signal to return.","type":"number"},"session_id":{"description":"The session to read from.","type":"string"}},"required":["session_id"],"type":"object"},"name":"read_window","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Read Window"},{"_meta":{"fastmcp":{"tags":[]}},"description":"List the channels a session is producing, with their buffer index.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session to inspect.","type":"string"}},"required":["session_id"],"type":"object"},"name":"get_channels","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Get Channels"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Open a recording and describe it without starting playback.\n\nUse this before start_replay to see how long the file is, what channels it\nhas, and which annotations will be re-emitted as events during replay.","inputSchema":{"additionalProperties":false,"properties":{"board":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Required only for BrainFlow CSV, which has no header describing\nits layout (e.g. 'cyton', 'synthetic')."},"max_events":{"default":100,"description":"Cap on how many of the file's events to list.","type":"integer"},"path":{"description":"Absolute path, or a filename inside the configured recordings dir.\nEDF/BDF/GDF/SET/FIF and anything else MNE reads; also BrainFlow CSV.","type":"string"}},"required":["path"],"type":"object"},"name":"inspect_recording","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Inspect Recording"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Replay a recording against a wall clock, re-emitting its events.\n\nThis is the safe way to build a real-time pipeline: the session behaves\nexactly like a live stream -- same buffering, same chunked delivery, same\ntools -- so code developed here runs unchanged against hardware. The\nrecording's annotations arrive in the event log at their original timings.","inputSchema":{"additionalProperties":false,"properties":{"board":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Required only for BrainFlow CSV files."},"loop":{"default":false,"description":"Restart from the beginning on reaching the end, emitting a\n'replay_loop' event each time. Good for long-running rehearsals.","type":"boolean"},"path":{"description":"Absolute path, or a filename inside the configured recordings dir.","type":"string"},"picks":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"MNE channel selection, e.g. 'eeg' or 'mag'. Defaults to EEG."},"session_id":{"description":"Name you will pass to every later call for this session.","type":"string"},"speed":{"default":1.0,"description":"Playback rate. 1.0 is true recording rate; 2.0 is twice as fast;\n0.5 is half. Faster-than-real-time is useful for testing a pipeline\nover a long recording, but stops being a realistic latency test.","type":"number"},"start_sec":{"default":0.0,"description":"Offset into the recording to begin from.","type":"number"},"use_stim_channel":{"default":true,"description":"Also extract events from a hardware trigger channel,\nnot just annotations.","type":"boolean"}},"required":["session_id","path"],"type":"object"},"name":"start_replay","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Start Replay"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Pause, resume, seek, or change the speed of a replay session.","inputSchema":{"additionalProperties":false,"properties":{"action":{"description":"One of 'pause', 'resume', 'seek', 'speed', 'status'.","type":"string"},"position_sec":{"anyOf":[{"type":"number"},{"type":"null"}],"default":null,"description":"Target position, required for action='seek'."},"session_id":{"description":"A session created by start_replay.","type":"string"},"speed":{"anyOf":[{"type":"number"},{"type":"null"}],"default":null,"description":"New playback rate, required for action='speed'."}},"required":["session_id","action"],"type":"object"},"name":"replay_control","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Replay Control"},{"_meta":{"fastmcp":{"tags":[]}},"description":"List all events present in a replay session's source file.\n\nDistinct from get_events: this is the *complete* event list from the file,\nincluding events that have not been reached yet. get_events returns only\nwhat has actually been emitted so far.","inputSchema":{"additionalProperties":false,"properties":{"max_events":{"default":200,"description":"Cap on the number returned.","type":"integer"},"session_id":{"description":"A session created by start_replay.","type":"string"}},"required":["session_id"],"type":"object"},"name":"list_recording_events","outputSchema":{"additionalProperties":true,"type":"object"},"title":"List Recording Events"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Install a stateful online filter chain on a running stream.\n\nThe chain filters continuously in the background as samples arrive, carrying\nfilter state across chunk boundaries. This matters: filtering each query\nwindow independently would inject a transient at every boundary and corrupt\nany phase-sensitive measure. Filtered output goes to a second buffer, so raw\nsignal remains available via read_window(filtered=False).\n\nThese are causal filters -- there is no zero-phase option, because that needs\nfuture samples. Check ``group_delay_sec`` in the response to know how far\nbehind real time your filtered features are.","inputSchema":{"additionalProperties":false,"properties":{"bandpass_high":{"anyOf":[{"type":"number"},{"type":"null"}],"default":40.0,"description":"Low-pass corner in Hz. None to skip the bandpass."},"bandpass_low":{"anyOf":[{"type":"number"},{"type":"null"}],"default":1.0,"description":"High-pass corner in Hz. None to skip the bandpass."},"filters":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"default":null,"description":"Advanced -- an explicit stage list that overrides the arguments\nabove, e.g. [{\"kind\": \"highpass\", \"low\": 0.5},\n{\"kind\": \"notch\", \"low\": 60, \"quality\": 30}].\nKinds: bandpass, bandstop, highpass, lowpass, notch."},"notch_freq":{"anyOf":[{"type":"number"},{"type":"null"}],"default":50.0,"description":"Mains frequency to notch out (50 in most of the world, 60 in\nthe Americas). None to skip."},"order":{"default":4,"description":"Butterworth order for the bandpass. 4 is a sensible default.","type":"integer"},"session_id":{"description":"The session to filter.","type":"string"}},"required":["session_id"],"type":"object"},"name":"set_filters","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Set Filters"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Remove the filter chain; reads return raw signal again.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session to clear filters on.","type":"string"}},"required":["session_id"],"type":"object"},"name":"clear_filters","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Clear Filters"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Band power over the most recent window, per channel and averaged.\n\nThe workhorse feature for neurofeedback and closed-loop triggering. Prefer\nthe ``_rel`` (relative) values for thresholds: they are largely immune to\nimpedance drift, so a threshold set at the start of a session still means\nthe same thing an hour later.","inputSchema":{"additionalProperties":false,"properties":{"bands":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"description":"Band names to compute. Defaults to delta, theta, alpha, beta, gamma."},"channels":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"description":"Channel names to include. Defaults to all."},"filtered":{"default":true,"description":"Use the filtered buffer when a chain is set.","type":"boolean"},"relative":{"default":true,"description":"Also return each band as a fraction of total power.","type":"boolean"},"seconds":{"default":2.0,"description":"Window length. 2 s is a reasonable default; shorter windows are\nnoisier, longer ones respond more slowly.","type":"number"},"session_id":{"description":"The session to analyse.","type":"string"}},"required":["session_id"],"type":"object"},"name":"get_band_power","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Get Band Power"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Power spectral density over the most recent window.\n\nUse when band power is too coarse -- to find a peak alpha frequency, confirm\na stimulation artifact, or check whether a notch actually removed the mains.","inputSchema":{"additionalProperties":false,"properties":{"channels":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"description":"Channel names to include. Defaults to all."},"filtered":{"default":true,"description":"Use the filtered buffer when a chain is set.","type":"boolean"},"fmax":{"default":60.0,"description":"Highest frequency to return.","type":"number"},"max_bins":{"default":120,"description":"Cap on returned frequency bins, to keep the response readable.","type":"integer"},"seconds":{"default":4.0,"description":"Window length. Longer gives finer frequency resolution.","type":"number"},"session_id":{"description":"The session to analyse.","type":"string"}},"required":["session_id"],"type":"object"},"name":"get_psd","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Get Psd"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Per-channel health check: amplitude, flat/railed detection, line noise.\n\nCall this before trusting any real-time feature, and definitely before\ndriving stimulation from one. A flat or railed electrode poisons an\naverage reference and a band-power threshold without changing anything you\nwould notice in the feature value itself.","inputSchema":{"additionalProperties":false,"properties":{"line_freq":{"default":50.0,"description":"Mains frequency to test for (50 or 60).","type":"number"},"seconds":{"default":2.0,"description":"Window length to assess.","type":"number"},"session_id":{"description":"The session to check.","type":"string"}},"required":["session_id"],"type":"object"},"name":"check_signal_quality","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Check Signal Quality"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Record an event against the stream's clock.\n\nFor anything the server did not generate itself: a task onset, a subject\nreport, an experimenter note. Stimulation commands are logged automatically\nby send_stim_event, so do not log those by hand.","inputSchema":{"additionalProperties":false,"properties":{"duration":{"default":0.0,"description":"Event duration in seconds. 0 for an instantaneous event.","type":"number"},"label":{"description":"Event name, e.g. 'trial_start' or 'eyes_closed'.","type":"string"},"mark_in_stream":{"default":true,"description":"Also punch the value into the acquisition stream's own\nmarker channel, so the recording carries the event independently.","type":"boolean"},"payload":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Any extra structured detail to keep with the event."},"session_id":{"description":"The session to annotate.","type":"string"},"value":{"default":1.0,"description":"Numeric code. Also written to the board's marker channel when\nmark_in_stream is set; BrainFlow reserves 0, so use a nonzero value.","type":"number"}},"required":["session_id","label"],"type":"object"},"name":"log_event","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Log Event"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Read the session's event log.\n\nEverything lands here on one clock: board markers, annotations re-emitted by\na replay, stimulation commands we dispatched, and manual notes. That is what\nmakes a closed-loop run reconstructible afterwards without joining clocks.","inputSchema":{"additionalProperties":false,"properties":{"label":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Filter to one event label."},"last_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"default":null,"description":"Only events from the last N seconds. None for all."},"limit":{"default":200,"description":"Maximum events to return, most recent first-truncated.","type":"integer"},"origin":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Filter by 'marker' (live board), 'annotation' (from a replayed\nfile), 'stim' (dispatched by us), or 'manual' (logged by hand)."},"session_id":{"description":"The session to read.","type":"string"}},"required":["session_id"],"type":"object"},"name":"get_events","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Get Events"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Extract the signal window around an event that already occurred.\n\nOnline epoching: use it to inspect the response to the most recent stimulus,\nor to verify that a stimulation artifact lands where you expect. The event\nmust still be inside the ring buffer -- for a default 60 s buffer, that means\nwithin the last minute.","inputSchema":{"additionalProperties":false,"properties":{"filtered":{"default":true,"description":"Use the filtered buffer when a chain is set.","type":"boolean"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Event label to find. None takes the most recent event of any kind."},"max_samples":{"default":500,"description":"Decimation cap per channel.","type":"integer"},"occurrence":{"default":-1,"description":"Which matching event; -1 is the most recent, -2 the one\nbefore it, 0 the earliest still in the log.","type":"integer"},"session_id":{"description":"The session to read from.","type":"string"},"tmax":{"default":0.8,"description":"Window end relative to the event, in seconds.","type":"number"},"tmin":{"default":-0.2,"description":"Window start relative to the event, in seconds (negative = before).","type":"number"}},"required":["session_id"],"type":"object"},"name":"get_epoch_around_event","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Get Epoch Around Event"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Empty the session's event log without stopping the stream.\n\nUseful between blocks of an experiment. The signal buffer is untouched.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session whose log to clear.","type":"string"}},"required":["session_id"],"type":"object"},"name":"clear_events","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Clear Events"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Fold an external LSL marker stream into this session's event log.\n\nThe reverse of attach_stim_backend(backend=\"lsl\"): that publishes markers\nfor other software to consume; this consumes markers *from* other\nsoftware -- PsychoPy is the common case, but anything that timestamps its\nown events over LSL works the same way. Each marker lands with\norigin='marker' at the sample index nearest its own LSL timestamp in the\nraw buffer, the same \"one event log, one clock\" treatment a board's own\nmarker channel gets.\n\nOnly one marker stream can be attached per session; attaching again\nreplaces the previous one.","inputSchema":{"additionalProperties":false,"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Resolve by outlet name instead, to pick one of several."},"resolve_timeout":{"default":5.0,"description":"Seconds to wait for the outlet before failing.","type":"number"},"session_id":{"description":"The session to annotate.","type":"string"},"stream_type":{"default":"Markers","description":"LSL type to resolve by. 'Markers' matches what PsychoPy\nand most LSL marker outlets (including this server's own\nattach_stim_backend(backend=\"lsl\")) declare by convention.","type":"string"}},"required":["session_id"],"type":"object"},"name":"attach_marker_stream","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Attach Marker Stream"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Stop listening for external markers on this session.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session to detach from.","type":"string"}},"required":["session_id"],"type":"object"},"name":"detach_marker_stream","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Detach Marker Stream"},{"_meta":{"fastmcp":{"tags":[]}},"description":"List stimulation targets, their options, and which ones drive hardware.\n\nSoftware backends ('log', 'lsl', 'brainflow_marker') are always available.\nHardware backends ('serial_ttl', 'tms', 'tes', 'template_serial') require\nthe server to have been started with EEG_MCP_ALLOW_HARDWARE_STIM=1, and must\nbe armed before each session of use.","inputSchema":{"additionalProperties":false,"properties":{},"type":"object"},"name":"list_stim_backends","outputSchema":{"additionalProperties":true,"type":"object"},"title":"List Stim Backends"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Bind a stimulation target to a session and open its transport.\n\nStart with backend='log' to rehearse a protocol with no output at all, then\nswitch once the timing looks right.","inputSchema":{"additionalProperties":false,"properties":{"backend":{"default":"log","description":"One of the names from list_stim_backends.","type":"string"},"make_default":{"default":true,"description":"Use this backend when send_stim_event omits one.","type":"boolean"},"options":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Backend-specific settings. For serial backends: {\"port\": \"COM3\"}.\nFor templated devices (tms, tes, template_serial), the commands from\nyour device manual, e.g.\n{\"port\": \"COM3\", \"templates\": {\"fire\": \"TRIG\\r\\n\",\n \"set_intensity\": \"AMP {intensity:.0f}\\r\\n\"}}."},"session_id":{"description":"The session to attach to.","type":"string"}},"required":["session_id"],"type":"object"},"name":"attach_stim_backend","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Attach Stim Backend"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Close and remove a stimulation backend from a session.","inputSchema":{"additionalProperties":false,"properties":{"backend":{"description":"The attached backend's name.","type":"string"},"session_id":{"description":"The session to detach from.","type":"string"}},"required":["session_id","backend"],"type":"object"},"name":"detach_stim_backend","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Detach Stim Backend"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Permit hardware stimulation for a bounded window.\n\nArming expires deliberately: an agent that stalls mid-protocol should not be\nable to resume and fire a stimulator minutes later without a fresh, explicit\ndecision. Re-arm as needed, or disarm the moment a block ends.","inputSchema":{"additionalProperties":false,"properties":{"backend":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Which attached backend. Defaults to the session default."},"session_id":{"description":"The session whose backend to arm.","type":"string"},"ttl_sec":{"default":300.0,"description":"How long the arming lasts, in seconds.","type":"number"}},"required":["session_id"],"type":"object"},"name":"arm_stim","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Arm Stim"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Revoke permission to stimulate. Takes effect immediately.","inputSchema":{"additionalProperties":false,"properties":{"backend":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Which attached backend. Defaults to the session default."},"session_id":{"description":"The session whose backend to disarm.","type":"string"}},"required":["session_id"],"type":"object"},"name":"disarm_stim","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Disarm Stim"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Deliver one stimulation command, and log it against the EEG clock.\n\nThe event is written to the session log whether the transport succeeds or\nfails -- a failed stimulation attempt matters just as much to the record.\nWhen the acquisition source supports markers, the same event is also punched\ninto the stream itself so the recording is self-describing.","inputSchema":{"additionalProperties":false,"properties":{"also_mark_source":{"default":true,"description":"Also write the code into the acquisition stream's own\nmarker channel.","type":"boolean"},"backend":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Which attached backend to use. Defaults to the session default."},"duration_ms":{"default":0.0,"description":"Pulse width or stimulation duration.","type":"number"},"intensity":{"anyOf":[{"type":"number"},{"type":"null"}],"default":null,"description":"Physical dose for hardware backends -- %MSO for TMS, mA for\ntES. Clamped against the configured ceiling; ignored by software\nbackends."},"kind":{"default":"marker","description":"'marker' (event code only), 'pulse' (code then clear after\nduration_ms), 'train', 'ramp', or 'custom'. Backends advertise which\nkinds they support via list_stim_backends.","type":"string"},"label":{"description":"Event name, e.g. 'tms_pulse' or 'cue_left'.","type":"string"},"params":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Extra fields made available to command templates."},"session_id":{"description":"The session to stimulate within.","type":"string"},"target":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Coil, montage or channel identifier, for the record."},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Unit label for intensity, for the record."},"value":{"default":1.0,"description":"Numeric code for marker streams and trigger lines. Nonzero.","type":"number"}},"required":["session_id","label"],"type":"object"},"name":"send_stim_event","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Send Stim Event"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Deliver a regular train of pulses, blocking until it completes.\n\nFor rTMS bursts and repeated cues. The call holds until the train finishes,\nso it is capped at 1000 pulses and 60 seconds total; build longer protocols\nfrom several calls so there are decision points in between.\n\nEvery pulse is logged individually, so the event log reconstructs the exact\ndelivered timing rather than the intended timing.","inputSchema":{"additionalProperties":false,"properties":{"backend":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Which attached backend. Defaults to the session default."},"duration_ms":{"default":0.0,"description":"Pulse width.","type":"number"},"intensity":{"anyOf":[{"type":"number"},{"type":"null"}],"default":null,"description":"Physical dose per pulse, clamped against the ceiling."},"interval_ms":{"description":"Inter-pulse interval. For rTMS this is 1000/frequency.","type":"number"},"label":{"description":"Base event name; pulses are logged as '<label>_<n>'.","type":"string"},"n_pulses":{"description":"How many pulses to deliver.","type":"integer"},"session_id":{"description":"The session to stimulate within.","type":"string"},"value":{"default":1.0,"description":"Numeric code for each pulse.","type":"number"}},"required":["session_id","label","n_pulses","interval_ms"],"type":"object"},"name":"send_stim_train","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Send Stim Train"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Report attached stimulation backends, arming state, and dispatch counts.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session to report on.","type":"string"}},"required":["session_id"],"type":"object"},"name":"stim_status","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Stim Status"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Open a live browser view of a running session and return its URL.\n\nServes a rolling traces view with event markers, band power and per-channel\nquality, refreshing continuously. This is the tool for \"let me watch the\nrecording\" -- a static plot cannot answer whether the signal is good *now*.\n\nWith ``allow_control`` (the default) the page also carries transport\nbuttons: play/pause, restart, skip, speed, stop, mark an event, and save a\nreport. Pass ``allow_control=false`` for a strictly read-only view, e.g.\nwhen showing the screen to someone who should not be able to alter the run.\n\nThe page is bound to 127.0.0.1 only and requires a random per-monitor token,\nso it is not reachable from the network. It is still unencrypted: do not\nexpose it through a tunnel or reverse proxy.","inputSchema":{"additionalProperties":false,"properties":{"allow_control":{"default":true,"description":"Enable the transport buttons and the control endpoint.","type":"boolean"},"port":{"default":0,"description":"TCP port on loopback. 0 lets the OS choose a free one.","type":"integer"},"refresh_ms":{"default":500,"description":"Redraw interval. 500 ms is smooth without loading the server.","type":"integer"},"session_id":{"description":"The running session to display.","type":"string"},"window_sec":{"default":5.0,"description":"Seconds of signal shown at once. Adjustable in the page too.","type":"number"}},"required":["session_id"],"type":"object"},"name":"start_monitor","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Start Monitor"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Close a session's live monitor and free its port.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session whose monitor to stop.","type":"string"}},"required":["session_id"],"type":"object"},"name":"stop_monitor","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Stop Monitor"},{"_meta":{"fastmcp":{"tags":[]}},"description":"List live monitors currently serving, with their URLs.","inputSchema":{"additionalProperties":false,"properties":{},"type":"object"},"name":"list_monitors","outputSchema":{"additionalProperties":true,"type":"object"},"title":"List Monitors"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Render the recent signal as a standalone HTML file and return its path.\n\nA frozen snapshot, unlike start_monitor -- use it to keep a record, attach to\na note, or share. The file inlines everything and needs no internet.","inputSchema":{"additionalProperties":false,"properties":{"channels":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"description":"Channel names to include. Defaults to all."},"filtered":{"default":true,"description":"Draw the filtered signal when a chain is set.","type":"boolean"},"seconds":{"default":10.0,"description":"How much recent signal to draw.","type":"number"},"session_id":{"description":"The session to plot.","type":"string"},"show_events":{"default":true,"description":"Overlay event markers on the traces.","type":"boolean"}},"required":["session_id"],"type":"object"},"name":"plot_stream","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Plot Stream"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Render the power spectrum and band composition as a standalone HTML file.","inputSchema":{"additionalProperties":false,"properties":{"channels":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"description":"Channel names to include. Defaults to all."},"filtered":{"default":true,"description":"Use the filtered signal when a chain is set.","type":"boolean"},"fmax":{"default":60.0,"description":"Highest frequency to draw.","type":"number"},"seconds":{"default":8.0,"description":"Window length. Longer gives finer frequency resolution.","type":"number"},"session_id":{"description":"The session to analyse.","type":"string"}},"required":["session_id"],"type":"object"},"name":"plot_spectrum","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Plot Spectrum"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Write a full review page: traces, spectrum, quality, and the event log.\n\nThe one artefact to keep from a session. Everything is inlined, so it opens\non any machine, needs no internet, and still renders years from now.","inputSchema":{"additionalProperties":false,"properties":{"include_spectrum":{"default":true,"description":"Add the PSD and band-power sections.","type":"boolean"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Free text to record at the top -- indication, montage, observations."},"seconds":{"default":10.0,"description":"Window of signal to include in the traces and spectrum.","type":"number"},"session_id":{"description":"The session to report on.","type":"string"}},"required":["session_id"],"type":"object"},"name":"export_report","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Export Report"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Begin writing the live signal to disk, continuously.\n\nCall this as soon as the session starts if you intend to keep the data. The\nring buffer only holds the last minute or so, so anything not recorded is\ngone -- a session streamed for an hour without recording leaves nothing but\nwhatever reports you exported.\n\nThe raw, unfiltered signal is written. Filter settings are stored alongside\nit so a filtered view is reproducible; the amplifier's actual output is not\nreconstructible from anything else.","inputSchema":{"additionalProperties":false,"properties":{"dataset":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Study or collection name that groups recordings together."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Explicit filename stem, overriding the BIDS-style name built from\nsubject/session/task/run."},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Free text kept with the recording."},"run":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Run number within the task, e.g. '01'."},"session_id":{"description":"The running session to record.","type":"string"},"session_label":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Visit or session label, e.g. '01' or 'baseline'."},"subject":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Participant identifier, e.g. 'sub-04' or a study code. Becomes\nthe subject row in the metadata store. Avoid direct identifiers."},"task":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"What the participant is doing, e.g. 'rest', 'motor-imagery'."}},"required":["session_id"],"type":"object"},"name":"start_recording","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Start Recording"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Finish the recording, write the ``.fif``, and register it for analysis.\n\nThe event log becomes annotations inside the file, and -- unless you pass\n``register=false`` -- a row is inserted into the metadata store with the\nsubject, task, run and provenance, so neuro-mcp can find and open it.","inputSchema":{"additionalProperties":false,"properties":{"keep_sidecar":{"default":false,"description":"Keep the raw crash-recovery files after conversion.\nNormally removed once the .fif is safely written.","type":"boolean"},"register":{"default":true,"description":"Insert the recording into the metadata database.","type":"boolean"},"session_id":{"description":"The session whose recording to finish.","type":"string"}},"required":["session_id"],"type":"object"},"name":"stop_recording","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Stop Recording"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Report whether a session is recording, and how much has been written.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session to check.","type":"string"}},"required":["session_id"],"type":"object"},"name":"recording_status","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Recording Status"},{"_meta":{"fastmcp":{"tags":[]}},"description":"List recordings in eeg-mcp's own metadata store, newest first.\n\nThis store belongs to eeg-mcp alone. Analysis tools read from it -- the\nschema is compatible with neuro-mcp's, so it can open this database and\nunderstand every row -- but nothing else writes to it.","inputSchema":{"additionalProperties":false,"properties":{"limit":{"default":25,"description":"Maximum number to return.","type":"integer"},"subject":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Only recordings for this participant identifier."}},"type":"object"},"name":"list_recordings","outputSchema":{"additionalProperties":true,"type":"object"},"title":"List Recordings"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Finish a recording whose process died before it could be closed.\n\nSamples are appended to disk as they arrive and the header is written up\nfront, precisely so an interrupted session is not lost. Point this at the\norphaned ``.eegmcp.json`` header to convert what was captured into a ``.fif``.\n\nEvents are not recoverable -- they lived in memory -- so the resulting file\ncarries signal without annotations.","inputSchema":{"additionalProperties":false,"properties":{"header_path":{"description":"Path to the ``<stem>.eegmcp.json`` left behind.","type":"string"},"keep_sidecar":{"default":false,"description":"Keep the raw files after conversion.","type":"boolean"}},"required":["header_path"],"type":"object"},"name":"recover_recording","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Recover Recording"},{"_meta":{"fastmcp":{"tags":[]}},"description":"List real-time processors available to attach, and where they came from.\n\nBuilt-ins are always present. Your own appear here once the **server**\nenvironment points at them -- via the ``eeg_mcp.processors`` entry point,\n``EEG_MCP_PLUGINS``, or ``EEG_MCP_PLUGIN_DIR``. They cannot be loaded from a\ntool call, because importing a module executes it and that would make\narbitrary code execution reachable from a model.","inputSchema":{"additionalProperties":false,"properties":{},"type":"object"},"name":"list_processors","outputSchema":{"additionalProperties":true,"type":"object"},"title":"List Processors"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Attach a processor to a session.\n\nA ``streaming`` processor runs inside the acquisition loop on every chunk,\nso it reacts within one poll interval without an agent round-trip -- that is\nhow closed-loop logic gets fast. The cost is that slow code stalls\nacquisition; ``processor_status`` reports each one's mean and worst-case\ntime so you can see whether yours is affordable.\n\nNon-streaming processors do nothing until you call ``run_processor``.","inputSchema":{"additionalProperties":false,"properties":{"params":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Processor-specific settings; see its ``params`` in the listing."},"processor":{"description":"Name from list_processors.","type":"string"},"session_id":{"description":"The session to attach to.","type":"string"}},"required":["session_id","processor"],"type":"object"},"name":"attach_processor","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Attach Processor"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Remove a processor from a session and release its state.","inputSchema":{"additionalProperties":false,"properties":{"processor":{"description":"The attached processor's name.","type":"string"},"session_id":{"description":"The session to detach from.","type":"string"}},"required":["session_id","processor"],"type":"object"},"name":"detach_processor","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Detach Processor"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Report attached processors, their health, and their cost.\n\n``mean_ms`` and ``max_ms`` are the numbers to watch for a streaming\nprocessor: if ``max_ms`` approaches the poll interval (50 ms by default) it\nis starving acquisition, which shows up as ``throughput_ratio`` below 1.0 in\nstream_status. A processor that raises 10 times is disabled automatically\nrather than being retried forever inside the producer loop.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session to report on.","type":"string"}},"required":["session_id"],"type":"object"},"name":"processor_status","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Processor Status"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Read a streaming processor's recent outputs.","inputSchema":{"additionalProperties":false,"properties":{"limit":{"default":20,"description":"How many recent outputs to return, newest last.","type":"integer"},"processor":{"description":"The attached processor's name.","type":"string"},"session_id":{"description":"The session to read from.","type":"string"}},"required":["session_id","processor"],"type":"object"},"name":"get_processor_output","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Get Processor Output"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Run a processor once on the most recent window, on demand.\n\nWorks for both modes: for a non-streaming processor this is the only way to\nexecute it, and for a streaming one it is a way to get an answer right now\nrather than waiting for its next scheduled output.","inputSchema":{"additionalProperties":false,"properties":{"filtered":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":null,"description":"Override the processor's declared preference for filtered or\nraw signal."},"processor":{"description":"The attached processor's name.","type":"string"},"seconds":{"default":2.0,"description":"Window length to pass in.","type":"number"},"session_id":{"description":"The session to read from.","type":"string"}},"required":["session_id","processor"],"type":"object"},"name":"run_processor","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Run Processor"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Clear accumulated processor state and outputs, without detaching them.\n\nUseful between experimental blocks, and after a replay seek, so a rolling\nwindow does not straddle the discontinuity.","inputSchema":{"additionalProperties":false,"properties":{"session_id":{"description":"The session whose processors to reset.","type":"string"}},"required":["session_id"],"type":"object"},"name":"reset_processors","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Reset Processors"},{"_meta":{"fastmcp":{"tags":[]}},"description":"Read discrete tokens from a tokenizing processor.\n\nFor feeding EEG into sequence models. Returns both the grouped tokens (one\ngroup per window) and a flat sequence, plus the vocabulary size and the\nchannel/band layout each position corresponds to.\n\nWorks with any attached processor exposing ``token_history`` -- the built-in\n``band_tokenizer`` is a starting point, and your own tokenizer plugs in the\nsame way.","inputSchema":{"additionalProperties":false,"properties":{"limit":{"default":32,"description":"How many recent token groups to return.","type":"integer"},"processor":{"default":"band_tokenizer","description":"The tokenizing processor's name.","type":"string"},"session_id":{"description":"The session to read from.","type":"string"}},"required":["session_id"],"type":"object"},"name":"get_tokens","outputSchema":{"additionalProperties":true,"type":"object"},"title":"Get Tokens"}]}}}
