From cc8cd5f1f2930c77de67f14524117564626d62fa Mon Sep 17 00:00:00 2001 From: Maximilien Tirard Date: Thu, 28 May 2026 10:43:48 +0100 Subject: [PATCH] Revise WolframLanguageEvaluator and context tool descriptions --- Kernel/Tools/Context.wl | 38 ++++++++++++++++-------- Kernel/Tools/WolframLanguageEvaluator.wl | 12 +++++--- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/Kernel/Tools/Context.wl b/Kernel/Tools/Context.wl index 1a57cfb0..b1d77615 100644 --- a/Kernel/Tools/Context.wl +++ b/Kernel/Tools/Context.wl @@ -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. \ @@ -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"; diff --git a/Kernel/Tools/WolframLanguageEvaluator.wl b/Kernel/Tools/WolframLanguageEvaluator.wl index f3ac85e3..dced3f47 100644 --- a/Kernel/Tools/WolframLanguageEvaluator.wl +++ b/Kernel/Tools/WolframLanguageEvaluator.wl @@ -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. \