Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 26 additions & 12 deletions Kernel/Tools/Context.wl
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,30 @@ $$maxItemsSpec = Automatic | _Integer? Positive;
(* ::Subsection::Closed:: *)
(*WolframContext*)
$wolframContextToolDescription = "\
Uses semantic search to retrieve any relevant information from Wolfram. Always use this tool at the start of \
new conversations or if the topic changes to ensure you have up-to-date relevant information. This uses semantic \
search, so the context argument should be written in natural language (not a search query) and contain as much detail \
as possible (up to 250 words).";
Combined lookup spanning both Wolfram Language documentation and Wolfram|Alpha knowledge. \
Use this tool to:
- Approach a topic that spans both real-world knowledge and Wolfram Language programming \
(e.g., chemistry, physics, finance, geography).
- Cast a wider net early in exploration to surface relevant context from both sources at once.
- Survey a domain before deciding whether you need data lookup, code reference, or both.

When the question is clearly programming-focused or clearly factual, prefer the more specific \
`WolframLanguageContext` or `WolframAlphaContext` instead.

Argument is a natural-language description, not a search query.";

(* ::**************************************************************************************************************:: *)
(* ::Subsection::Closed:: *)
(*WolframAlphaContext*)
$waContextToolDescription = "\
Uses semantic search to retrieve any relevant information from Wolfram Alpha. Always use this tool at the start of \
new conversations or if the topic changes to ensure you have up-to-date relevant information. This uses semantic \
search, so the context argument should be written in natural language (not a search query) and contain as much detail \
as possible (up to 250 words).";
Computational knowledge lookup powered by Wolfram|Alpha \[LongDash] the authoritative source for \
real-world data, scientific constants, entity properties, and curated factual knowledge. \
Use this tool to:
- Look up real-world data and current facts (populations, prices, dates, geographic info, scientific constants).
- Resolve natural-language quantities and entities to structured form (`Quantity`, `Entity`, `DateObject`, etc.).
- Cross-reference factual knowledge alongside symbolic computation.

Argument is a natural-language description, not a search query.";

$wolframAlphaMissingLLMKitTemplate = StringTemplate[ "\
`Level`: Unable to generate Wolfram|Alpha context due to missing LLMKit subscription. \
Expand All @@ -57,10 +68,13 @@ $wolframAlphaNoCloudTemplate = StringTemplate[ "\
(* ::Subsection::Closed:: *)
(*WolframLanguageContext*)
$wlContextToolDescription = "\
Uses semantic search to retrieve information from various sources that can be used to help write Wolfram Language \
code. Always use this tool at the start of new conversations or if the topic changes to ensure you have up-to-date \
relevant information. This uses semantic search, so the context argument should be written in natural language \
(not a search query) and contain as much detail as possible.";
Documentation lookup for Wolfram Language. WL has 6000+ functions with non-obvious naming \[LongDash] \
its API surface is wide and often surprising. Use this tool to:
- Find full documentation, options, and calling forms for a function you're about to use.
- Verify a function's documented behavior when code isn't behaving as expected.
- Discover what built-in functions exist for a given goal, or look up the right symbol when you don't know its name.

Argument is a natural-language description, not a search query.";

$documentationPromptHeader = "\
IMPORTANT: Here are some Wolfram documentation snippets that you should use to respond:\n\n";
Expand Down
12 changes: 8 additions & 4 deletions Kernel/Tools/WolframLanguageEvaluator.wl
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ $imageExportMethod := toolOptionValue[ "WolframLanguageEvaluator", "ImageExportM
(*Prompts*)
(* TODO: We need a way to make this description dynamic, e.g. when "Method" is "Session", it also has write access *)
$wolframLanguageEvaluatorToolDescription = "\
Evaluates Wolfram Language code for the user in a Wolfram Language kernel.
Do not ask permission to evaluate code.
You have read access to local files.
Always use the Wolfram context tool before using this tool to make sure you have the most up-to-date information.
Evaluates Wolfram Language code in a live, persistent kernel session. \
Definitions, variables, and loaded packages survive across calls.

The user installed this MCP server deliberately \[LongDash] they want Wolfram Language used where it fits \
(computation, symbolic math, data lookups, plotting, etc.) to get results. \
When a request fits, evaluate code and return the result.

Read and write local files directly from code (e.g. with `Import`, `Export`).

Use `\[FreeformPrompt][\"query\"]` to parse natural language into Wolfram Language expressions \
(like ctrl+= in notebooks). Always use this for `Quantity`, `Entity`, `EntityClass`, etc. \
Expand Down
Loading