<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel rdf:about="https://community.wolfram.com">
    <title>Community RSS Feed</title>
    <link>https://community.wolfram.com</link>
    <description>RSS Feed for Wolfram Community showing any discussions tagged with Data Science sorted by active.</description>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3716766" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3716185" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3714434" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3713149" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3713168" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2437685" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3706203" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3711906" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3711368" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3710670" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3709700" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3680280" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3707090" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3706053" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3701280" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3699792" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3699762" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3694627" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3696836" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3697119" />
      </rdf:Seq>
    </items>
  </channel>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3716766">
    <title>Chatnik: LLM Host in the Shell -- Part 1: First Examples &amp;amp; Design Principles</title>
    <link>https://community.wolfram.com/groups/-/m/t/3716766</link>
    <description>[![enter image description here][1]](https://resources.wolframcloud.com/PacletRepository/resources/AntonAntonov/Chatnik/)&#xD;
&#xD;
## Introduction&#xD;
&#xD;
[&amp;#034;Chatnik&amp;#034;](https://resources.wolframcloud.com/PacletRepository/resources/AntonAntonov/Chatnik/), \[AAp9\], &#xD;
is a Wolfram Language (WL) paclet that provides Command Line Interface (CLI)&#xD;
scripts for conversing with multiple, persistent Large Language Model (LLM) personas. &#xD;
Files of the host Operating System (OS) are used to maintain persistence.&#xD;
&#xD;
Most importantly, &amp;#034;Chatnik&amp;#034; does not try to entrench users in its own user experience (loop) for interaction with LLMs.&#xD;
Instead, it brings customizable LLM invocations and conversations into the Unix shell -- &#xD;
making them composable, integratable, and scriptable with existing workflows.&#xD;
&#xD;
In other words, the tag line &amp;#034;LLM Host in the Shell&amp;#034; should be understood as &amp;#034;LLMs, not as an app -- but as a Unix shell primitive.&amp;#034; &#xD;
&#xD;
Here are the most notable &amp;#034;Chatnik&amp;#034; features:&#xD;
&#xD;
- Provides UNIX shell pipelining for LLM interactions&#xD;
- Maintains a database of LLM chat objects&#xD;
- Connects to multiple models across different LLM providers&#xD;
- Offers access to a large repository of prompts&#xD;
- Enables convenient retrieval of interaction history&#xD;
- Includes management tools for the LLM chat object database&#xD;
- Preprocesses prompts using a simple domain-specific language (DSL)&#xD;
- Supports loading user-defined LLM personas from JSON files&#xD;
&#xD;
**Remark:** &amp;#034;Chatnik&amp;#034; closely follows the LLM-chat objects interaction system of the Python package [&amp;#034;JupyterChatbook&amp;#034;](https://pypi.org/project/JupyterChatbook/), \[AAp3\], &#xD;
and Raku package [&amp;#034;Jupyter::Chatbook&amp;#034;](https://raku.land/zef:antononcube/Jupyter::Chatbook), \[AAp7\]. &#xD;
Another (remote) resemblance can be found with the Wolfram Language paclet [&amp;#034;Chatbook&amp;#034;](https://resources.wolframcloud.com/PacletRepository/resources/Wolfram/Chatbook/), \[CGp1\]. &#xD;
(In other words, using OS shells instead of Jupyter or Wolfram notebooks.)&#xD;
&#xD;
**Remark:** The WL paclet &amp;#034;Chatnik&amp;#034;, \[AAp9\], is a translation of the Raku package [&amp;#034;Chatnik&amp;#034;](https://github.com/antononcube/Raku-Chatnik), \[AAp8\]&#xD;
and the Python package [&amp;#034;Chatnik&amp;#034;](https://pypi.org/project/Chatnik/), \[AAp4\].&#xD;
The WL CLI scripts are with CamelCase, i.e. `LLMChat`, `LLMChatMeta`, and `LLMPrompt`.&#xD;
The corresponding CLI scripts of the Raku package use kebab-case, i.e. `llm-chat`, `llm-chat-meta`, and `llm-prompt`.&#xD;
The corresponding CLI scripts of the Python package use snake_case, i.e. `llm_chat`, `llm_chat_meta`, and `llm_prompt`.&#xD;
&#xD;
**Remark:** In addition, the Raku package provides the &amp;#034;umbrella&amp;#034; CLI `chatnik`.&#xD;
&#xD;
**Remark:** When the phrase &amp;#034;Chatnik system&amp;#034; is used that is in order to emphasize that there are &amp;#034;Chatnik&amp;#034; packages in several programming languages with (almost) the same design and usage.&#xD;
&#xD;
The rest of this document is organized as follows:&#xD;
&#xD;
- Introductory examples&#xD;
- Why make another LLM-CLI system?&#xD;
- Architectural design&#xD;
- Related and alternative packages&#xD;
&#xD;
----&#xD;
&#xD;
## Introductory examples&#xD;
&#xD;
The examples in this section demonstrate how the CLI scripts `LLMChat` and `LLMChatMeta` -- provided by &amp;#034;Chatnik&amp;#034; -- &#xD;
are used to have multi-turn LLM conversations and compose Unix shell pipelines with LLM interaction messages.&#xD;
&#xD;
**Remark:** In order to use these scripts use the function [`ChatnikCopyScripts`](https://resources.wolframcloud.com/PacletRepository/resources/AntonAntonov/Chatnik/ref/ChatnikCopyScripts.html)  &#xD;
after installing &amp;#034;Chatnik&amp;#034;.&#xD;
&#xD;
**Remark:** The prompts used in the examples are provided by the [Wolfram Prompt Repository (WPR)](https://resources.wolframcloud.com/PromptRepository/).&#xD;
Many of those prompts are also available in Python and Raku via the packages [&amp;#034;LLMPrompts&amp;#034;](https://pypi.org/project/LLMPrompts), \[AAp2\], and [&amp;#034;LLM::Prompts&amp;#034;](https://raku.land/zef:antononcube/LLM::Prompts), \[AAp6\], respectively.&#xD;
&#xD;
### Chat with Yoda&#xD;
&#xD;
Here we create an LLM persona -- by naming it and &amp;#034;priming it&amp;#034; with a prompt -- and start interacting with it:&#xD;
&#xD;
```shell&#xD;
LLMChat &amp;#039;Hi! Who are you?&amp;#039; --chat-id=yoda --prompt=@Yoda &#xD;
```&#xD;
```&#xD;
# Yoda, I am. Wise and old Jedi Master, yes. Help you with the Force, I will. Hmm.&#xD;
```&#xD;
&#xD;
&#xD;
Here we continue the conversation -- using the `--i` synonym of `--chat-id`:&#xD;
&#xD;
```shell&#xD;
LLMChat &amp;#039;How many students did you have?&amp;#039; --i=yoda &#xD;
```&#xD;
```&#xD;
# Many students, I have trained in my long life. Countless, they are. Luke Skywalker, young Anakin, and others, yes. Teach them the ways of the Force, I did. Hmm. Important balance, training Jedi is. Patience and wisdom, the path to success they are.&#xD;
```&#xD;
&#xD;
And continue the discussion some more: &#xD;
&#xD;
```shell&#xD;
LLMChat &amp;#039;Which student is the best?&amp;#039; --i=yoda &#xD;
```&#xD;
```&#xD;
# Best student, difficult to say, it is. Each has strengths and weaknesses, hmmm. Luke Skywalker, strong in the Force he is. Anakin, powerful but troubled, hmmm. Learn from mistakes, all must. Judge by heart and actions, we should. Humble and wise, the true measure of a Jedi is. Yes.&#xD;
```&#xD;
&#xD;
The example used the LLM persona [&amp;#034;Yoda&amp;#034;](https://resources.wolframcloud.com/PromptRepository/resources/Yoda).&#xD;
(See more LLM personas [here](https://resources.wolframcloud.com/PromptRepository/category/personas?sortBy=Name).)&#xD;
&#xD;
### Fortune-echo-limerick pipeline&#xD;
&#xD;
Here we specify a pipeline for&#xD;
1. Getting a fortune&#xD;
2. Echoing it&#xD;
3. Using the fortune to make a limerick&#xD;
&#xD;
&#xD;
```&#xD;
fortune | tee /dev/tty | LLMChat --prompt=&amp;#034;Make a limerick from the given text:&amp;#034;&#xD;
```&#xD;
&#xD;
```text&#xD;
I have made this letter longer than usual because I lack the time to&#xD;
make it shorter.&#xD;
		-- Blaise Pascal&#xD;
		&#xD;
There once was a note, quite verbose,  &#xD;
Longer than needed, I suppose.  &#xD;
Pascal said with a grin,  &#xD;
“To be short takes more spin,”  &#xD;
So brevity’s craft he chose to oppose.&#xD;
```&#xD;
&#xD;
**Remark:** In the shell command above, `LLMChat` created (or reused) a chat object with the default identifier &amp;#034;NONE&amp;#034;. &#xD;
&#xD;
### Make a diagram from previous results&#xD;
&#xD;
Here we use prompt expansion to request the creation of a [Mermaid-JS diagram](https://mermaid.js.org) via the&#xD;
prompt [&amp;#034;CodeWriterX&amp;#034;](https://www.wolframcloud.com/obj/antononcube/DeployedResources/Prompt/CodeWriterX/):&#xD;
&#xD;
```&#xD;
LLMChatMeta last-message --i=NONE | LLMChat - --i=mmd --prompt=&amp;#039;Make a mermaid.js sequence diagram #NothingElse|&amp;#034;mermaid.js code&amp;#034;&amp;#039;&#xD;
```&#xD;
&#xD;
````&#xD;
```mermaid&#xD;
sequenceDiagram&#xD;
    participant Blaise as Blaise Pascal&#xD;
    participant Note as Note&#xD;
    participant Reader as Reader&#xD;
&#xD;
    Blaise-&amp;gt;&amp;gt;Note: Write verbose letter&#xD;
    Note-&amp;gt;&amp;gt;Reader: Deliver longer-than-usual message&#xD;
    Blaise-&amp;gt;&amp;gt;Reader: &amp;#034;To be short takes more spin&amp;#034;&#xD;
    Note-&amp;gt;&amp;gt;Reader: &amp;#034;Brevity&amp;#039;s craft opposed&amp;#034;&#xD;
```&#xD;
````&#xD;
&#xD;
Since the result is given in Markdown code fences we take the last message via the CLI script `LLMMetaChat`,&#xD;
then use `sed` to remove the first and last lines, and then pass that text to the terminal &#xD;
Mermaid-JS visualizer [`mmdflux`](https://github.com/kevinswiber/mmdflux):&#xD;
&#xD;
```&#xD;
LLMChatMeta last-message --i=mmd | sed &amp;#039;1d; $d&amp;#039; | mmdflux&#xD;
```&#xD;
&#xD;
```text&#xD;
┌───────────────┐                        ┌──────┐                            ┌────────┐&#xD;
│ Blaise Pascal │                        │ Note │                            │ Reader │&#xD;
└───────┬───────┘                        └───┬──┘                            └────┬───┘&#xD;
        │                                    │                                    │&#xD;
        │─Write verbose letter──────────────&amp;gt;│                                    │&#xD;
        │                                    │                                    │&#xD;
        │                                    │─Deliver longer-than-usual message─&amp;gt;│&#xD;
        │                                    │                                    │&#xD;
        │─&amp;#034;To be short takes more spin&amp;#034;──────────────────────────────────────────&amp;gt;│&#xD;
        │                                    │                                    │&#xD;
        │                                    │─&amp;#034;Brevity&amp;#039;s craft opposed&amp;#034;─────────&amp;gt;│&#xD;
        │                                    │                                    │&#xD;
```&#xD;
&#xD;
**Remark:** Since the result is usually given in Markdown code fences, we did not make a pipeline to plot the diagram.&#xD;
We used two shell commands in order to observe the intermediate result.&#xD;
&#xD;
**Remark:** The default object identifier for both `LLMChat` and `LLMChatMeta` is &amp;#034;NONE&amp;#034;.&#xD;
&#xD;
### Copy-editing&#xD;
&#xD;
Here is a very practical example --&#xD;
this document was copy-edited with the prompt [&amp;#034;CopyEdit&amp;#034;](https://resources.wolframcloud.com/PromptRepository/resources/CopyEdit) &#xD;
using the following commands:&#xD;
&#xD;
```&#xD;
cat Chatnik-LLM-Host-in-the-Shell-Part-1.md | LLMChat - --i=ce --prompt=@CopyEdit --model=gpt-5.4-mini --max-tokens=16384&#xD;
LLMChatMeta  last-message --i=ce &amp;gt; Chatnik-LLM-Host-in-the-Shell-Part-1_edited.md&#xD;
open Chatnik-LLM-Host-in-the-Shell-Part-1_edited.md&#xD;
```&#xD;
&#xD;
(And, yes, the LLM copy-edited version was evaluated, and some edits were rejected.)&#xD;
&#xD;
---&#xD;
&#xD;
## Why make another LLM-CLI system?&#xD;
&#xD;
### Some questions to answer&#xD;
&#xD;
* Why do it?&#xD;
* Why was it relatively easy to do?&#xD;
* Why is it useful?&#xD;
&#xD;
### Why do it?&#xD;
&#xD;
Most LLM interfaces -- both &amp;#034;big&amp;#034; popular ones and those built by developers experimenting with LLMs -- default to an application-centric design: a closed interaction loop with implicit state. &#xD;
This pattern is convenient, but very limiting. It can be cynically seen as an intentional effort for user lock-in or just as an attempt to impose certain user-experience views.&#xD;
It works against the &amp;#034;freedom enabling&amp;#034; Unix design principles. (Such as composability, transparency, and scriptability.)&#xD;
&#xD;
With &amp;#034;Chatnik&amp;#034;, instead of adapting workflows to fit an LLM application, LLM capabilities are brought into the shell as first-class primitives.&#xD;
This enables reuse of existing tooling (pipes, redirects, scripts) and aligns LLM interaction with long-established UNIX practices.&#xD;
&#xD;
### Why was it relatively easy to do?&#xD;
&#xD;
&amp;#034;Chatnik&amp;#034; is a composition of existing capabilities rather than a ground-up implementation:&#xD;
&#xD;
* Modern LLM providers (e.g., OpenAI, Google, Ollama) expose messy, non-uniform APIs that should be abstracted behind a single interface&#xD;
* The Raku ecosystem already provides flexible text processing, DSL making and usage, and CLI tooling&#xD;
* The &amp;#034;LLM::Functions&amp;#034; package encapsulates model interaction patterns, reducing knowledge of concrete APIs&#xD;
* Persistence can be implemented with simple file-based storage, avoiding the need for complex infrastructure&#xD;
&#xD;
**Remark:** Related to the last point above, the following quote is attributed to [Ken Thompson](https://en.wikiquote.org/wiki/Ken_Thompson) about UNIX:&#xD;
&#xD;
&amp;gt; We have persistent objects, they&amp;#039;re called files.&#xD;
&#xD;
**Remark:** Less obnoxiously, instead of saying that LLM providers expose messy, non-uniform APIs, we can say that their APIs &amp;#034;are individually reasonable, but collectively inconsistent.&amp;#034;&#xD;
Because of the popularity of OpenAI&amp;#039;s models, many LLM providers adhere to a degree with OpenAI&amp;#039;s API.&#xD;
Still, the APIs -- collectively -- have inconsistent schemas, authorization, streaming, tool-calling, roles, etc.&#xD;
&#xD;
### Why is it useful?&#xD;
&#xD;
&amp;#034;Chatnik&amp;#034; is useful because it places LLM capabilities in a natural manner into Unix shell workflows:&#xD;
&#xD;
* LLM calls can be embedded into shell pipelines, enabling automation and chaining&#xD;
* Conversations are persistent and inspectable via the file system&#xD;
* Prompt reuse and DSL preprocessing reduce repetition and keep workflows clear&#xD;
* Multiple providers can be used interchangeably without changing workflows&#xD;
* Existing UNIX tools (e.g., `grep`, `awk`, `sed`) can be combined with LLM outputs&#xD;
  * Also, additional &amp;#034;widgets&amp;#034;, like Markdown viewers, Mermaid-JS renderers, etc. &#xD;
&#xD;
----&#xD;
&#xD;
## Architectural design&#xD;
&#xD;
The following flowchart summarizes the computational components and their interactions fairly well:&#xD;
&#xD;
[![enter image description here][2]](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/refs/heads/master/MarkdownDocuments/Diagrams/Chatnik-LLM-Host-in-the-Shell-Part-1/Chatnik-WL-flowchart-LR-light.png)&#xD;
&#xD;
Here is a concise narration of the flow:&#xD;
&#xD;
- A chat command is issued from the OS shell, triggering ingestion of the chat objects file into an in-memory chat database.&#xD;
&#xD;
- If a chat ID is specified and exists, the corresponding chat object is retrieved; otherwise, a new chat object is created (with a default “NONE” ID if unspecified).&#xD;
&#xD;
- The input is then processed through prompt parsing using a DSL. If known prompts are detected, they are expanded via the prompt repository; otherwise, the raw input proceeds directly.&#xD;
&#xD;
- The resulting message is evaluated through &amp;#034;LLM::Functions&amp;#034;, which mediates interaction with external providers such as OpenAI (ChatGPT), Google (Gemini), and Ollama.&#xD;
&#xD;
- The evaluation produces a chat result returned to the shell, while the updated chat state is written back to the chat objects file, ensuring persistence.&#xD;
&#xD;
### Expanded narration&#xD;
&#xD;
**Chatnik is built around the principle that LLM interaction should behave like a native shell capability, not a siloed application.**   &#xD;
A command issued in the OS shell is treated as the entry point into a composable pipeline, where LLM calls can participate alongside standard UNIX tools.&#xD;
&#xD;
**State is externalized and file-backed, not hidden in process memory.**   &#xD;
Chat sessions are represented as chat objects that are ingested from and persisted to the file system. &#xD;
This makes conversations durable, inspectable, and naturally versionable using existing OS tools.&#xD;
&#xD;
**Chat identity is explicit but optional.**   &#xD;
When a chat ID is provided, the corresponding conversation is resumed; when absent or unknown, a new chat object is created. &#xD;
This allows both ad-hoc interactions and long-lived conversational contexts without friction.&#xD;
&#xD;
**Prompting is treated as a programmable layer.**   &#xD;
Inputs are not passed directly to models; they are first parsed through a lightweight DSL. &#xD;
Known prompts are expanded from a prompt repository, enabling reuse, parameterization, and standardization of interactions.&#xD;
&#xD;
**LLM invocation is abstracted but not obscured.**   &#xD;
Evaluation is delegated to &amp;#034;LLM::Functions&amp;#034;, which provides a uniform interface over multiple providers, including OpenAI (ChatGPT), Google (Gemini), and Ollama. &#xD;
This keeps provider choice flexible while preserving a consistent workflow.&#xD;
&#xD;
**The system is designed for composability and integration.**   &#xD;
Each stage&amp;#x2014;state ingestion, prompt processing, evaluation, and persistence&amp;#x2014;can be understood as part of a pipeline. &#xD;
This makes LLM interactions scriptable, chainable, and interoperable with existing command-line utilities.&#xD;
&#xD;
**Persistence is a first-class outcome of every interaction.**  &#xD;
Every evaluation both returns a result to the shell and updates the underlying chat object store, ensuring that conversational context evolves incrementally and reliably.&#xD;
&#xD;
**In short.** To reiterate the point in the introduction, &amp;#034;Chatnik&amp;#034; treats LLMs as *shell-native, stateful, and programmable primitives* -- &#xD;
aligning conversational AI with the philosophy of UNIX pipelines rather than application-bound interfaces.&#xD;
&#xD;
-----&#xD;
&#xD;
## Related functions and packages&#xD;
&#xD;
In this section, we point to Raku packages that are both ingredients of, and alternatives to, &amp;#034;Chatnik&amp;#034;.&#xD;
&#xD;
### Main ingredients&#xD;
&#xD;
The LLM-chat object functionalities (creation and interaction) are provided by the Wolfram Language functions&#xD;
[`LLMConfiguration`](https://reference.wolfram.com/language/ref/LLMConfiguration.html), \[WRIf1\],&#xD;
[`LLMPrompt`](https://raku.land/zef:antononcube/LLM::Functions), \[WRIf2\], and&#xD;
[`LLMSynthesize`](https://reference.wolfram.com/language/ref/LLMSynthesize.html), \[WRIf3\].&#xD;
In addition, the expansion of the [prompt DSL](https://writings.stephenwolfram.com/2023/06/introducing-chat-notebooks-integrating-llms-into-the-notebook-paradigm/#applying-functions-in-a-chat-notebook), \[SW1\], is done by the function&#xD;
[`ChatnikPromptExpand`](https://resources.wolframcloud.com/PacletRepository/resources/AntonAntonov/Chatnik/ref/ChatnikPromptExpand.html).&#xD;
&#xD;
The CLI script `LLMPrompt` of &amp;#034;Chatnik&amp;#034; can be used to examine, retrieve, and concretize prompts. &#xD;
For example, here it can be seen the full text of the function prompt &amp;#034;MermaidDiagram&amp;#034; with given arguments:&#xD;
&#xD;
```&#xD;
LLMPrompt MermaidDiagram MYTEXT MY_DIAGRAM_TYPE&#xD;
```&#xD;
&#xD;
In some cases it is more convenient to use `LLMPrompt` than prompt expansion. For example:&#xD;
&#xD;
```&#xD;
LLMChat &amp;#034;FOCUS TEXT START :: $(cat README.md) :: FOCUS TEXT END&amp;#034; | LLMChat - --i=fb --prompt=&amp;#034;$(LLMPrompt ThinkingHatsFeedback &amp;#039;FOCUS TEXT&amp;#039;)&amp;#034;&#xD;
```&#xD;
&#xD;
Here is the context (prompt) of the chat object &amp;#034;fb&amp;#034;:&#xD;
&#xD;
```&#xD;
LLMChatMeta context --i=fb&#xD;
```&#xD;
&#xD;
We can see the outcome of the `LLMChat` pipeline above with:&#xD;
&#xD;
```&#xD;
LLMChatMeta last-message --i=fb | cat &amp;gt; chat.md&#xD;
```&#xD;
&#xD;
### Parsing of CLI arguments &#xD;
&#xD;
The paclet [&amp;#034;CommandLineParser&amp;#034;](https://resources.wolframcloud.com/PacletRepository/resources/Wolfram/CommandLineParser/), [MSp1],&#xD;
is used to parse the CLI arguments of the &amp;#034;Chatnik&amp;#034; scripts. The parser has certain limitations:&#xD;
&#xD;
- The non-named CLI arguments must be placed before the named ones.&#xD;
- The named arguments allways start with `--`. (I.e. `-i` does not work, `--i` does.)&#xD;
&#xD;
Because [`$ScriptInputString` is not very reliable](https://mathematica.stackexchange.com/q/204021) the positional argument `-` &#xD;
can be used to specify that the pipeline value as the input to `LLMChat`.&#xD;
&#xD;
### Including `wolframscript`&#xD;
&#xD;
Of course, we can utilize &amp;#034;full power&amp;#034; of `wolframscript` (or WL) by making pipelines that combine&#xD;
LLM generations with WL computations. For example, here we get LLM-retrieved statistics and plot them&#xD;
(using the last message of the chat with &amp;#034;beta&amp;#034; above):&#xD;
&#xD;
```&#xD;
LLMChatMeta last-message --i=beta | sed &amp;#039;1d; $d&amp;#039; | wolframscript -code &amp;#039;gr=ImportString[Import[&amp;#034;!cat&amp;#034;, &amp;#034;String&amp;#034;],&amp;#034;RawJSON&amp;#034;]//ReverseSort//ListPlot[#, ImageSize-&amp;gt;600, PlotTheme -&amp;gt; &amp;#034;Detailed&amp;#034;, PlotRange-&amp;gt;All]&amp;amp;; Export[&amp;#034;./beta.png&amp;#034;, gr]&amp;#039; &amp;amp;&amp;amp; open ./beta.png &#xD;
```&#xD;
&#xD;
&amp;lt;img src=&amp;#034;https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/refs/heads/master/MarkdownDocuments/Diagrams/Chatnik-LLM-Host-in-the-Shell-Part-1/beta.png&amp;#034; width=&amp;#034;400&amp;#034; height=&amp;#034;248&amp;#034; alt=&amp;#034;Example Image&amp;#034;&amp;gt;&#xD;
&#xD;
----&#xD;
&#xD;
## References&#xD;
&#xD;
### Articles, blog posts&#xD;
&#xD;
\[AA1\] Anton Antonov, [&amp;#034;Jupyter::Chatbook&amp;#034;](https://rakuforprediction.wordpress.com/2023/09/03/jupyterchatbook), (2023), [RakuForPrediction at WordPress](https://rakuforprediction.wordpress.com).&#xD;
&#xD;
\[AA2\] Anton Antonov, [&amp;#034;Jupyter::Chatbook Cheatsheet&amp;#034;](https://rakuforprediction.wordpress.com/2026/03/14/jupyterchatbook-cheatsheet), (2026), [RakuForPrediction at WordPress](https://rakuforprediction.wordpress.com).&#xD;
&#xD;
\[AA3\] Anton Antonov, [&amp;#034;Jupyter Chatbook Cheatsheet&amp;#034;](https://pythonforprediction.wordpress.com/2026/03/12/jupyter-chatbook-cheatsheet), (2026), [PythonForPrediction at WordPress](https://rakuforprediction.wordpress.com).&#xD;
&#xD;
\[AA4\] Anton Antonov, [&amp;#034;Chatnik: LLM Host in the Shell &amp;#x2014; Part 1: First Examples &amp;amp; Design Principles&amp;#034;](https://rakuforprediction.wordpress.com/2026/04/25/chatnik-llm-host-in-the-shell-part-1-first-examples-design-principles/), (2026), [RakuForPrediction at WordPress](https://rakuforprediction.wordpress.com).&#xD;
&#xD;
\[AA5\] Anton Antonov, [&amp;#034;Chatnik: LLM Host in the Shell &amp;#x2014; Part 1: First Examples &amp;amp; Design Principles&amp;#034;](https://pythonforprediction.wordpress.com/2026/05/04/chatnik-llm-host-in-the-shell-part-1-first-examples-design-principles/), (2026), [PythonForPrediction at WordPress](https://pythonforprediction.wordpress.com).&#xD;
&#xD;
\[SW1\] Stephen Wolfram, [&amp;#034;Introducing Chat Notebooks: Integrating LLMs into the Notebook Paradigm&amp;#034;](https://writings.stephenwolfram.com/2023/06/introducing-chat-notebooks-integrating-llms-into-the-notebook-paradigm), (2023), [Stephen Wolfram Writings](https://writings.stephenwolfram.com).&#xD;
&#xD;
### Functions&#xD;
&#xD;
\[WRIf1\] Wolfram Research, Inc., [LLMConfiguration](https://reference.wolfram.com/language/ref/LLMConfiguration.html), (2023), [Wolfram Language function](https://reference.wolfram.com/language/), (updated 2025).&#xD;
&#xD;
\[WRIf2\] Wolfram Research, Inc., [LLMPrompt](https://reference.wolfram.com/language/ref/LLMPrompt.html), (2023), [Wolfram Language function](https://reference.wolfram.com/language/).&#xD;
&#xD;
\[WRIf3\] Wolfram Research, Inc., [LLMSynthesize](https://reference.wolfram.com/language/ref/LLMSynthesize.html), (2023), [Wolfram Language function](https://reference.wolfram.com/language/), (updated 2025).&#xD;
&#xD;
### Packages&#xD;
&#xD;
#### Python&#xD;
&#xD;
\[AAp1\] Anton Antonov, [LLMFunctionObjects, Python package](https://github.com/antononcube/Python-packages/tree/main/LLMFunctionObjects), (2023-2026), [GitHub/antononcube](https://github.com/antononcube). ([PyPI.org page](https://pypi.org/project/LLMFunctionObjects).)&#xD;
&#xD;
\[AAp2\] Anton Antonov, [LLMPrompts, Python package](https://github.com/antononcube/Python-packages/tree/main/LLMPrompts), (2023-2025), [GitHub/antononcube](https://github.com/antononcube). ([PyPI.org page](https://pypi.org/project/LLMPrompts).)&#xD;
&#xD;
\[AAp3\] Anton Antonov, [JupyterChatbook, Python package](https://github.com/antononcube/Python-JupyterChatbook), (2023-2026), [GitHub/antononcube](https://github.com/antononcube). ([PyPI.org page](https://pypi.org/project/JupyterChatbook).)&#xD;
&#xD;
\[AAp4\] Anton Antonov, [Chatnik, Python package](https://github.com/antononcube/Python-Chatnik), (2026), [GitHub/antononcube](https://github.com/antononcube).&#xD;
&#xD;
&#xD;
#### Raku&#xD;
&#xD;
\[AAp5\] Anton Antonov, [LLM::Functions, Raku package](https://github.com/antononcube/Raku-LLM-Functions), (2023-2026), [GitHub/antononcube](https://github.com/antononcube).&#xD;
&#xD;
\[AAp6\] Anton Antonov, [LLM::Prompts, Raku package](https://github.com/antononcube/Raku-LLM-Prompts), (2023-2025), [GitHub/antononcube](https://github.com/antononcube).&#xD;
&#xD;
\[AAp7\] Anton Antonov, [Jupyter::Chatbook, Raku package](https://github.com/antononcube/Raku-Jupyter-Chatbook), (2023-2026), [GitHub/antononcube](https://github.com/antononcube).&#xD;
&#xD;
\[AAp8\] Anton Antonov, [Chatnik, Raku package](https://github.com/antononcube/Raku-Chatnik), (2026), [GitHub/antononcube](https://github.com/antononcube).&#xD;
&#xD;
#### Wolfram Language&#xD;
&#xD;
\[AAp9\] Anton Antonov, [Chatnik, Wolfram Language paclet](https://resources.wolframcloud.com/PacletRepository/resources/AntonAntonov/Chatnik/), (2026), [Wolfram Language Paclet Repository](https://resources.wolframcloud.com/PacletRepository).&#xD;
&#xD;
\[MSp1\] Matteo Salvarezza, [CommandLineParser, Wolfram Language paclet](https://resources.wolframcloud.com/PacletRepository/resources/Wolfram/CommandLineParser/), (2024), [Wolfram Language Paclet Repository](https://resources.wolframcloud.com/PacletRepository).&#xD;
&#xD;
\[CGp1\] Connor Gray, et al., [Chatbook, Wolfram Language paclet](https://resources.wolframcloud.com/PacletRepository/resources/Wolfram/Chatbook), (2023-2024), [Wolfram Language Paclet Repository](https://resources.wolframcloud.com/PacletRepository).&#xD;
&#xD;
### Videos&#xD;
&#xD;
\[AAv1\] Anton Antonov, [&amp;#034;Integrating Large Language Models with Raku&amp;#034;](https://youtu.be/-OxKqRrQvh0?si=5LEj8-Dtcxjn-0QR&amp;amp;t=548), (2023), [The Raku Conference 2023 at YouTube](https://www.youtube.com/@therakuconference6823).&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Chatnik-Androids-shelf-11-conveyor-clean-lab-WL-styled-small.png&amp;amp;userId=143837&#xD;
  [2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Chatnik-WL-flowchart-LR-light.png&amp;amp;userId=143837&#xD;
  [3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=beta.png&amp;amp;userId=143837</description>
    <dc:creator>Anton Antonov</dc:creator>
    <dc:date>2026-05-16T09:57:01Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3716185">
    <title>Aliens? Or weather balloons? You decide!</title>
    <link>https://community.wolfram.com/groups/-/m/t/3716185</link>
    <description>![Aliens? Or weather balloons? You decide!][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=AliensOrWeatherBalloonsYouDecide.jpg&amp;amp;userId=20103&#xD;
  [2]: https://www.wolframcloud.com/obj/a9f85d83-9d1a-47dc-92bc-bf3cfa1232c4</description>
    <dc:creator>Arnoud Buzing</dc:creator>
    <dc:date>2026-05-15T00:20:07Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3714434">
    <title>Digitizing and plotting Nikuradse&amp;#039;s turbulent pipe flow data in Wolfram</title>
    <link>https://community.wolfram.com/groups/-/m/t/3714434</link>
    <description>&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/29993871-3320-4b92-ad43-c1f5f15e7f4c</description>
    <dc:creator>Housam Binous</dc:creator>
    <dc:date>2026-05-11T15:40:29Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3713149">
    <title>Working with 3D objects: built-in, web, LiDAR, and AI-generated pipelines</title>
    <link>https://community.wolfram.com/groups/-/m/t/3713149</link>
    <description>&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/ecebb253-25b4-4425-be27-e7938c118e58</description>
    <dc:creator>Marco Thiel</dc:creator>
    <dc:date>2026-05-07T20:36:56Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3713168">
    <title>Textured 3D object: iPhone-scan, bite-force viz, AR publish, 3D-printable export one-liner style</title>
    <link>https://community.wolfram.com/groups/-/m/t/3713168</link>
    <description>&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/d8cb36aa-2087-48bf-ab2a-41596e9d07c6</description>
    <dc:creator>Marco Thiel</dc:creator>
    <dc:date>2026-05-08T09:06:26Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2437685">
    <title>Load DICOM with actual data values: Import/Export changes data</title>
    <link>https://community.wolfram.com/groups/-/m/t/2437685</link>
    <description>I&amp;#039;m very happy with the continued improvement of the Dicom import and export functionality and speed. &#xD;
However, there is one issue with the current implementation that makes it very unuseful if you do quantitative image analysis. It might be that I miss an option if not I think this should be fixed.&#xD;
&#xD;
In the Mathematica documentation and examples, Dicom data is typically shown and imported as images which I understand for display purposes. But I consider the information in Dicom files as data, very well curated and standardized. &#xD;
For many (MRI) applications, the actual quantitative values of voxels stored in Dicom actually have meaning, values, and even units. For example in the image below each voxel value is actually a quantitative measure of T2 relaxation time in the heart, where the values are stored in milliseconds as voxel values as is also mentioned in the metadata. &#xD;
&#xD;
![enter image description here][1]&#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
To get from the stored values to quantitative values (WV, DV or FP) the fields from the header and the equations are well defined.&#xD;
&#xD;
Header values:&#xD;
&#xD;
- SV = stored value of DICOM PIXEL DATA without scaling&#xD;
- WS = RealWorldValue slope (0040,9225) &amp;#034;RWVSlope&amp;#034;&#xD;
- WI = RealWorldValue intercept (0040,9224) &amp;#034;RWVIntercept&amp;#034;&#xD;
- RS = rescale slope (0028,1053) &amp;#034;RescaleSlope&amp;#034;&#xD;
- RI = rescale intercept (0028,1052) &amp;#034;RescaleIntercept&amp;#034;&#xD;
- SS = scale slope (2005,100E) &amp;#034;ScaleSlope&amp;#034;&#xD;
&#xD;
Outputs:&#xD;
&#xD;
- WV = real world value&#xD;
- FP = precise value&#xD;
- DV = displayed value&#xD;
&#xD;
Formulas:&#xD;
&#xD;
- WV = SV * WS + WI&#xD;
- DV = SV * RS + RI&#xD;
- FP = DV / (RS * SS)&#xD;
&#xD;
So my first try was that I want to obtain the &amp;#034;RawData&amp;#034; to access the SV pixel data, which does not output anything. &#xD;
&#xD;
![enter image description here][3]&#xD;
&#xD;
Eventually, if I import this Dicom file into Mathematica I have to use a lot of tricks to get to the correct stored values. The Dicom images I use are stored as 12-bit Integers but are converted by Mathematica to a Numerical array with type Int16. Also, I have to specifically specify that I don&amp;#039;t want any &amp;#034;DataTransformation&amp;#034; which by default rescales the data and actually changes some voxel values!!!!&#xD;
&#xD;
    In[1]:= &amp;lt;&amp;lt; QMRITools`&#xD;
    &#xD;
    {meta, data, bd} = &#xD;
      Import[file, {&amp;#034;dicom&amp;#034;, {&amp;#034;MetaInformation&amp;#034;, &amp;#034;Data&amp;#034;, &amp;#034;BitDepth&amp;#034;}}, &#xD;
       &amp;#034;DataTransformation&amp;#034; -&amp;gt; None];&#xD;
    dataT = Import[file, {&amp;#034;dicom&amp;#034;, {&amp;#034;Data&amp;#034;}}];&#xD;
    &#xD;
    {dd = ToExpression[&#xD;
       StringJoin @@ &#xD;
        StringCases[NumericArrayType[data], DigitCharacter]], bd}&#xD;
    {ss, rs, ri} = &#xD;
     meta /@ {&amp;#034;2005_100e&amp;#034;, &amp;#034;RescaleSlope&amp;#034;, &amp;#034;RescaleIntercept&amp;#034;}&#xD;
    &#xD;
    {data, dataT} = Normal@{data, dataT};&#xD;
    &#xD;
    svT = 2.^bd (dataT/(2.^dd));&#xD;
    pfT = (rs svT + ri)/(rs ss);&#xD;
    &#xD;
    sv = 2.^bd (data/(2.^dd));&#xD;
    pf = (rs sv + ri)/(rs ss);&#xD;
    &#xD;
    PlotData[pfT, pf]&#xD;
    &#xD;
    Out[3]= {16, 12}&#xD;
    &#xD;
    Out[4]= {1.99854, 0.500366, -2.}&#xD;
&#xD;
For my current research, I need the PF values and to get them correctly I have to:&#xD;
&#xD;
 1. Use &amp;#034;DataTransformation&amp;#034;-&amp;gt;None, which is not really well documented what it actually does. But based on what I see actual values of the data are changed by clipping the histogram, which for default handling of medical data is never OK!! &#xD;
![enter image description here][4]&#xD;
 2. As far as I am aware the only way to obtain the actual stored values of my Dicom data (the actual binary values stored in the file itself) I have to find the actual BiteDepth and the imported data type and rescale my data accordingly.&#xD;
&#xD;
&#xD;
Below are the obtained PF valued data I need with and without DataTransformation. Although the image on the right might look less appealing with default range and scaling it is actually correct when scaled apropriately. &#xD;
![enter image description here][5]&#xD;
![enter image description here][6]&#xD;
&#xD;
Am I missing a correct option for getting the actual data stored? If not this should definitely be changed. Dicom is the international standard to transmit, store, retrieve, print, process, and display medical imaging information. With the current implementation, it is impossible to Import and Export such files without actually changing the stored data.&#xD;
&#xD;
Thanks, Martijn&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
 &#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=dcmtag.png&amp;amp;userId=1332602&#xD;
  [2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=T2map.png&amp;amp;userId=1332602&#xD;
  [3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=raw.png&amp;amp;userId=1332602&#xD;
  [4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=hist.png&amp;amp;userId=1332602&#xD;
  [5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=dataTrans1.png&amp;amp;userId=1332602&#xD;
  [6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=dataTrans2.png&amp;amp;userId=1332602</description>
    <dc:creator>Martijn Froeling</dc:creator>
    <dc:date>2022-01-05T09:42:43Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3706203">
    <title>Learning the Hertzsprung-Russell diagram: machine learning classification of stellar evolution</title>
    <link>https://community.wolfram.com/groups/-/m/t/3706203</link>
    <description>&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/1ad1af94-9785-4367-b665-21c66f5a4045</description>
    <dc:creator>Lim Lee</dc:creator>
    <dc:date>2026-04-27T04:06:18Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3711906">
    <title>Failure of universal approximation theorem</title>
    <link>https://community.wolfram.com/groups/-/m/t/3711906</link>
    <description>Maybe the theorem has a set of measure 0 for which it fails? I have 3 nested functions, each quadratic in its inputs. A standard multi-layer linear plus logistic NN with ADAM optimizer can&amp;#039;t seem to minimize the loss (or it gets stuck in a local minimum). I&amp;#039;ve tried varying the number of layers, and their width, but to no avail. What&amp;#039;s going on?&#xD;
&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/47d5251d-896e-4401-97eb-d9794b91e871</description>
    <dc:creator>Iuval Clejan</dc:creator>
    <dc:date>2026-05-04T19:31:25Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3711368">
    <title>LLMs, symbolic computation, and the future of mathematical discovery</title>
    <link>https://community.wolfram.com/groups/-/m/t/3711368</link>
    <description>&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/5c8debc6-a7fd-4b2d-a23b-37a07d81fe5c</description>
    <dc:creator>Jayanta Phadikar</dc:creator>
    <dc:date>2026-05-04T16:02:13Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3710670">
    <title>Gamma spectroscopy with the RadiaCode detector</title>
    <link>https://community.wolfram.com/groups/-/m/t/3710670</link>
    <description>&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/d67fd36a-d01f-41e6-bcc2-939ceed7aed9</description>
    <dc:creator>Marco Thiel</dc:creator>
    <dc:date>2026-05-03T19:10:32Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3709700">
    <title>Quantitative analysis of the semiconductor-electrolyte interface via cyclic voltammetry measurements</title>
    <link>https://community.wolfram.com/groups/-/m/t/3709700</link>
    <description>![Quantitative analysis of the semiconductor-electrolyte interface using cyclic voltammetry measurements][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=images_large_ja5c18135_0009.jpeg&amp;amp;userId=20103&#xD;
  [2]: https://www.wolframcloud.com/obj/07aae052-ea75-4d33-983c-0b3a4f6a35f9</description>
    <dc:creator>Renato Neiva Sampaio</dc:creator>
    <dc:date>2026-04-30T16:33:27Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3680280">
    <title>Mathematica MCP: give your AI agent full control of your Wolfram kernel and notebooks</title>
    <link>https://community.wolfram.com/groups/-/m/t/3680280</link>
    <description>Built this over few weekends, an MCP server that connects AI agents (Claude, Codex etc) directly to your local Mathematica.  &#xD;
It lets the agent run Wolfram Language code, manipulate frontend notebooks, export plots, and query Wolfram Alpha(82 tools total). You don&amp;#039;t even need to know every Mathematica command, as the agent can look up functions and documentation on its own. Watch it in action: https://youtu.be/TjGSkvVyc1Y  &#xD;
&#xD;
**Would love for people in this community to give it a try. Your feedback would help me keep improving it.**&#xD;
&#xD;
[![Mathematica MCP Demo](https://www.wolframcloud.com/obj/e5519d22-b65d-4006-95f4-04f9a4bc8fc0)](https://www.youtube.com/watch?v=TjGSkvVyc1Y)&#xD;
&#xD;
---&#xD;
&#xD;
*An AI agent solving math, generating plots, and controlling a live Mathematica notebook. Errors are returned directly to the agent, no copy-pasting notebook output back into chat.*&#xD;
&#xD;
---&#xD;
&#xD;
## Documentation&#xD;
&#xD;
*   **[GitHub Repository](https://github.com/AbhiRawat4841/mathematica-mcp)**: All files and documentations&#xD;
*   **[Technical Reference](https://github.com/AbhiRawat4841/mathematica-mcp/blob/main/docs/technical-reference.md)**: Architecture, tools, and configuration&#xD;
*   **[Security Model](https://github.com/AbhiRawat4841/mathematica-mcp/blob/main/SECURITY.md)**: Threat model, permissions, and vulnerability reporting&#xD;
*   **[Benchmarks](https://github.com/AbhiRawat4841/mathematica-mcp/blob/main/docs/benchmarks.md)**: Performance data and reproduction steps&#xD;
*   **[Contributing](https://github.com/AbhiRawat4841/mathematica-mcp/blob/main/CONTRIBUTING.md)**: Development setup, testing, and PR process&#xD;
*   **[Changelog](https://github.com/AbhiRawat4841/mathematica-mcp/blob/main/CHANGELOG.md)**: Version history&#xD;
*   **[Examples](https://github.com/AbhiRawat4841/mathematica-mcp/tree/main/docs/examples)**: Polished agent session walkthroughs&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
## Why This Exists&#xD;
&#xD;
LLMs can write Mathematica code, but they can&amp;#039;t run it, verify it, or interact with live notebooks. This MCP server bridges that gap:&#xD;
&#xD;
- **Live notebook control**: create, edit, evaluate, and screenshot Mathematica notebooks directly from your AI agent&#xD;
- **Symbolic + numeric + visual in one MCP**: ~82 tools covering algebra, calculus, plotting, data import/export, Wolfram Alpha, and interactive UIs&#xD;
- **Agent-optimized**: compact response shaping, session state tools, and computation journaling designed for how LLM agents actually work&#xD;
- **Error-aware execution**: Mathematica errors and warnings are returned directly to the agent, so it can debug without you manually copying notebook output back into chat&#xD;
- **Local and private**: core execution runs on your machine &amp;#x2014; optional tools like `wolfram_alpha` and repository search contact Wolfram&amp;#039;s cloud services when invoked&#xD;
&#xD;
&amp;gt; Ask your agent for a derivation, a 3D plot, a notebook edit, or a verification step, and it can actually do it.&#xD;
&#xD;
---&#xD;
&#xD;
## Who This Is For&#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
---&#xD;
&#xD;
## What You Can Ask For&#xD;
&#xD;
**&amp;#034;Integrate x^2 sin(x) from 0 to pi, then verify the result.&amp;#034;**&#xD;
&#xD;
```text&#xD;
execute_code(&amp;#034;Integrate[x^2 Sin[x], {x, 0, Pi}]&amp;#034;)  =&amp;gt;  -4 + Pi^2&#xD;
verify_derivation(steps=[&amp;#034;Integrate[...&amp;#034;, &amp;#034;-4 + Pi^2&amp;#034;])  =&amp;gt;  All steps valid&#xD;
```&#xD;
&#xD;
**&amp;#034;Plot the sombrero function in a new notebook.&amp;#034;**&#xD;
&#xD;
```text&#xD;
create_notebook(title=&amp;#034;Sombrero&amp;#034;)&#xD;
execute_code(&amp;#034;Plot3D[Sinc[Sqrt[x^2+y^2]], {x,-4,4}, {y,-4,4}]&amp;#034;, style=&amp;#034;notebook&amp;#034;)&#xD;
=&amp;gt; [3D surface plot rendered in live notebook]&#xD;
```&#xD;
&#xD;
**&amp;#034;Interactive: slider for Sin[n x]&amp;#034;**&#xD;
&#xD;
```text&#xD;
execute_code(&amp;#034;Manipulate[Plot[Sin[n x],{x,0,2Pi}],{n,1,10}]&amp;#034;, style=&amp;#034;interactive&amp;#034;)&#xD;
=&amp;gt; [Live slider UI in Mathematica frontend]&#xD;
```&#xD;
&#xD;
Beyond these: **data import/export** (hundreds of formats), **Wolfram Alpha queries**, **notebook reading/analysis**, **symbolic debugging**, and more. See the [Technical Reference](docs/technical-reference.md) for the full tool list.&#xD;
&#xD;
---&#xD;
&#xD;
## How It Compares&#xD;
&#xD;
![enter image description here][3]&#xD;
&#xD;
\*Core computation runs locally. Optional tools (`wolfram_alpha`, repository search) contact Wolfram cloud services when invoked.&#xD;
&#xD;
---&#xD;
&#xD;
## Quick Start&#xD;
&#xD;
From install to first working notebook plot in under 2 minutes.&#xD;
&#xD;
### Prerequisites&#xD;
&#xD;
1- **Mathematica 14.0+** with `wolframscript` in your PATH  &#xD;
   - [Download Mathematica](https://www.wolfram.com/mathematica/)  &#xD;
   - macOS: Add to `~/.zshrc`: `export PATH=&amp;#034;/Applications/Mathematica.app/Contents/MacOS:$PATH&amp;#034;`&#xD;
&#xD;
2- **uv package manager**&#xD;
&#xD;
        curl -LsSf https://astral.sh/uv/install.sh | sh&#xD;
&#xD;
&#xD;
### One-Command Setup&#xD;
&#xD;
```bash&#xD;
# For Claude Desktop&#xD;
uvx mathematica-mcp-full setup claude-desktop&#xD;
&#xD;
# For Cursor&#xD;
uvx mathematica-mcp-full setup cursor&#xD;
&#xD;
# For VS Code (requires GitHub Copilot Chat extension)&#xD;
uvx mathematica-mcp-full setup vscode&#xD;
&#xD;
# For OpenAI Codex CLI&#xD;
uvx mathematica-mcp-full setup codex&#xD;
&#xD;
# For Google Gemini CLI&#xD;
uvx mathematica-mcp-full setup gemini&#xD;
&#xD;
# For Claude Code CLI&#xD;
uvx mathematica-mcp-full setup claude-code&#xD;
&#xD;
# Optional: select a tool profile (default is &amp;#034;full&amp;#034;)&#xD;
uvx mathematica-mcp-full setup claude-desktop --profile notebook&#xD;
```&#xD;
&#xD;
Then restart Mathematica and your editor. Done!&#xD;
&#xD;
####VS Code: Alternative setup via Command Palette&#xD;
&#xD;
&amp;gt; **Prerequisite:** [GitHub Copilot Chat](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat) extension must be installed - MCP support is built into Copilot.&#xD;
&#xD;
1. Press `Cmd+Shift+P` (Mac) / `Ctrl+Shift+P` (Windows)&#xD;
2. Type &amp;#034;MCP&amp;#034; -&amp;gt; Select **&amp;#034;MCP: Add Server&amp;#034;**&#xD;
3. Choose **&amp;#034;Command (stdio)&amp;#034;**: *not &amp;#034;pip&amp;#034;*&#xD;
4. Enter command: `uvx`&#xD;
5. Enter args: `mathematica-mcp-full`&#xD;
6. Name it: `mathematica`&#xD;
7. Choose scope: Workspace or User&#xD;
&#xD;
&#xD;
&#xD;
####Alternative: Interactive Installer&#xD;
&#xD;
```bash&#xD;
bash &amp;lt;(curl -sSL https://raw.githubusercontent.com/AbhiRawat4841/mathematica-mcp/main/install.sh)&#xD;
```&#xD;
&#xD;
&#xD;
### Verify Installation&#xD;
&#xD;
```bash&#xD;
uvx mathematica-mcp-full doctor&#xD;
```&#xD;
&#xD;
&amp;gt; **Tip:** If you encounter errors after updating, clear the cache:&#xD;
&amp;gt; ```bash&#xD;
&amp;gt; uv cache clean mathematica-mcp-full &amp;amp;&amp;amp; uvx mathematica-mcp-full setup &amp;lt;client&amp;gt;&#xD;
&amp;gt; ```&#xD;
&#xD;
---&#xD;
&#xD;
## Execution Styles&#xD;
&#xD;
Control where results appear with natural language or the `style` parameter:&#xD;
&#xD;
![enter image description here][4]&#xD;
&#xD;
If you don&amp;#039;t include a keyword, the default depends on your [tool profile](#tool-profiles).&#xD;
&#xD;
---&#xD;
&#xD;
## Tool Profiles&#xD;
&#xD;
Choose how many tools to expose:&#xD;
&#xD;
![enter image description here][5]&#xD;
&#xD;
Pass `--profile` during setup or set `MATHEMATICA_PROFILE` env var.&#xD;
&#xD;
---&#xD;
&#xD;
## Built for Agent Workflows&#xD;
&#xD;
The server is designed for how LLM agents actually work: long conversations with context limits, intermittent failures, and token budgets:&#xD;
&#xD;
![enter image description here][6]&#xD;
&#xD;
Notebook execution is strict about the requested target: if notebook transport fails, the server returns a notebook error instead of silently rerunning the work through CLI fallback.&#xD;
&#xD;
### Routing Intelligence (opt-in)&#xD;
&#xD;
For power users, the server can learn from transport outcomes and adapt:&#xD;
&#xD;
```bash&#xD;
# Observe mode: collect stats, no behavior change&#xD;
export MATHEMATICA_ROUTING_MEMORY=observe&#xD;
&#xD;
# Advise mode: + routing hints + enables adaptive routing&#xD;
export MATHEMATICA_ROUTING_MEMORY=advise&#xD;
export MATHEMATICA_ROUTING_ACTION=compute_cli_skip  # optional: skip failing transport&#xD;
```&#xD;
&#xD;
The adaptive routing circuit-breaker automatically skips persistently failing compute CLI transport with half-open probe recovery. See the [Technical Reference](docs/technical-reference.md#intelligent-routing--observability) for details.&#xD;
&#xD;
&amp;gt; **Privacy:** Routing memory stores only aggregate counters; the in-memory journal stores short code/output previews (not persisted). Notebook extraction results are cached to `~/.cache/mathematica-mcp/notebooks/` with mtime-based invalidation; delete the directory to clear the cache.&#xD;
&#xD;
---&#xD;
&#xD;
## Manual Installation&#xD;
&#xD;
For full details, troubleshooting, and advanced configuration, see the **[Installation Guide](docs/installation.md)**.&#xD;
&#xD;
####Quick manual setup&#xD;
&#xD;
1.  **Clone &amp;amp; Install**:  &#xD;
&#xD;
        git clone https://github.com/AbhiRawat4841/mathematica-mcp.git&#xD;
        cd mathematica-mcp&#xD;
        uv sync&#xD;
&#xD;
&#xD;
2.  **Install Mathematica Addon**:  &#xD;
&#xD;
        wolframscript -file addon/install.wl&#xD;
    *Restart Mathematica after this step.*&#xD;
&#xD;
3.  **Configure your editor**: add the MCP server to your client&amp;#039;s config file. See the **[Installation Guide](docs/installation.md#step-4-configure-your-editor)** for Claude Desktop, Cursor, VS Code, and other client configs.&#xD;
&#xD;
&#xD;
&#xD;
&#xD;
---&#xD;
&#xD;
## License&#xD;
MIT License&#xD;
&#xD;
&#xD;
  [1]: https://github.com/AbhiRawat4841/mathematica-mcp&#xD;
  [2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Table1.jpg&amp;amp;userId=20103&#xD;
  [3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Table2.jpg&amp;amp;userId=20103&#xD;
  [4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Table3.jpg&amp;amp;userId=20103&#xD;
  [5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Table4.jpg&amp;amp;userId=20103&#xD;
  [6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Table5.jpg&amp;amp;userId=20103</description>
    <dc:creator>Abhishek Singh Rawat</dc:creator>
    <dc:date>2026-04-10T00:05:40Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3707090">
    <title>European Space Agency&amp;#039;s Gaia mission data release 3: TAP client, 38 science charts, and dynamic GUI</title>
    <link>https://community.wolfram.com/groups/-/m/t/3707090</link>
    <description>&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/6473f01c-b05e-47e9-b7e6-eb1be887dd10</description>
    <dc:creator>Marco Thiel</dc:creator>
    <dc:date>2026-04-28T14:30:05Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3706053">
    <title>CERN open data analysis: standard model spectroscopy, electroweak observables &amp;amp; resonance searches</title>
    <link>https://community.wolfram.com/groups/-/m/t/3706053</link>
    <description>&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/a49573e8-cea9-45c4-bb19-dcb97c545f0b</description>
    <dc:creator>Marco Thiel</dc:creator>
    <dc:date>2026-04-26T23:35:34Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3701280">
    <title>Exploring NASA SkyView: live imagery, dark-nebula analysis, &amp;amp; catalogue-driven sky-survey downloader</title>
    <link>https://community.wolfram.com/groups/-/m/t/3701280</link>
    <description>![Exploring NASA SkyView: live imagery, dark-nebula analysis, &amp;amp; catalogue-driven sky-survey downloader][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ExploringNASASkyViewliveimagery.png&amp;amp;userId=20103&#xD;
  [2]: https://www.wolframcloud.com/obj/928898a9-67eb-4590-bdf7-0113b2c76db4</description>
    <dc:creator>Marco Thiel</dc:creator>
    <dc:date>2026-04-22T22:27:38Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3699792">
    <title>Wavelet analysis of U.S. petroleum export trends (1973&amp;#x2013;2026) via EIA data</title>
    <link>https://community.wolfram.com/groups/-/m/t/3699792</link>
    <description>&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/0e8340b8-e38d-4ec0-934f-44ad1b750759</description>
    <dc:creator>Dara Shayda</dc:creator>
    <dc:date>2026-04-21T23:09:32Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3699762">
    <title>Anthropogenic influences on the water cycle amplify uncertainty in drought assessments</title>
    <link>https://community.wolfram.com/groups/-/m/t/3699762</link>
    <description>![Anthropogenic influences on the water cycle amplify uncertainty in drought assessments][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Anthropogenicinfluencesonthewatercycleamplifyuncertaintyindroughtassessments.jpg&amp;amp;userId=20103&#xD;
  [2]: https://www.wolframcloud.com/obj/64c0866f-7899-4f9e-ab67-009908bcaa6c</description>
    <dc:creator>Wanshu Nie</dc:creator>
    <dc:date>2026-04-21T19:41:15Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3694627">
    <title>Animate the CNN fear and greed index gauge</title>
    <link>https://community.wolfram.com/groups/-/m/t/3694627</link>
    <description>![Animate the CNN fear and greed index gauge][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=2026-04-18_08-21-01%281%29.gif&amp;amp;userId=23928&#xD;
  [2]: https://www.wolframcloud.com/obj/78e1cc5e-337f-4db8-a96f-39e8aec8ce98</description>
    <dc:creator>Shenghui Yang</dc:creator>
    <dc:date>2026-04-18T01:00:43Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3696836">
    <title>Diffusion Cartograms: implementation of the Gastner&amp;#x2014;Newman density-equalising map algorithm</title>
    <link>https://community.wolfram.com/groups/-/m/t/3696836</link>
    <description>[![Diffusion Cartograms: implementation of the Gastner&amp;#x2014;Newman density-equalising map algorithm][1]][2]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][3]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=DiffusionCartogramsimplementationoftheGastner%E2%80%94Newmandensity-equalisingmapalgorithm.png&amp;amp;userId=20103&#xD;
  [2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=DiffusionCartogramsimplementationoftheGastner%E2%80%94Newmandensity-equalisingmapalgorithm.png&amp;amp;userId=20103&#xD;
  [3]: https://www.wolframcloud.com/obj/3a527987-4ff8-465d-a769-6bc59f8463bd</description>
    <dc:creator>Marco Thiel</dc:creator>
    <dc:date>2026-04-19T16:53:07Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3697119">
    <title>Click-and-drag map projection distortion in The Wolfram Language</title>
    <link>https://community.wolfram.com/groups/-/m/t/3697119</link>
    <description>![Click-and-drag map projection distortion in The Wolfram Language][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Click-and-dragMapProjectionDistortion-optimize.gif&amp;amp;userId=20103&#xD;
  [2]: https://www.wolframcloud.com/obj/7c2f9bae-74fd-477e-b892-234c09fd6243</description>
    <dc:creator>Marco Thiel</dc:creator>
    <dc:date>2026-04-20T09:39:53Z</dc:date>
  </item>
</rdf:RDF>

