From 5f740932e7e7363ae3d404f52682a3116bbc6442 Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Tue, 16 Dec 2025 15:02:14 -0800 Subject: [PATCH 1/2] feat: add conditional execution for Python agent tools --- package.json | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 286e80baa2df..1f02ea86cced 100644 --- a/package.json +++ b/package.json @@ -1528,7 +1528,8 @@ } }, "required": [] - } + }, + "when": "editorLangId == python || resourceLangId == python || notebookType == jupyter-notebook" }, { "name": "get_python_executable_details", @@ -1553,7 +1554,8 @@ } }, "required": [] - } + }, + "when": "editorLangId == python || resourceLangId == python || notebookType == jupyter-notebook" }, { "name": "install_python_packages", @@ -1588,7 +1590,8 @@ "required": [ "packageList" ] - } + }, + "when": "editorLangId == python || resourceLangId == python || notebookType == jupyter-notebook" }, { "name": "configure_python_environment", @@ -1612,7 +1615,8 @@ } }, "required": [] - } + }, + "when": "editorLangId == python || resourceLangId == python || notebookType == jupyter-notebook" }, { "name": "create_virtual_environment", From 5f33bcee29f329e1d8d05f461e4a2665c36c3d65 Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Wed, 17 Dec 2025 10:17:10 -0800 Subject: [PATCH 2/2] update descriptions and remove when clauses --- package.json | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 1f02ea86cced..719d819025ab 100644 --- a/package.json +++ b/package.json @@ -1509,7 +1509,7 @@ "name": "get_python_environment_details", "displayName": "Get Python Environment Info", "userDescription": "%python.languageModelTools.get_python_environment_details.userDescription%", - "modelDescription": "This tool will retrieve the details of the Python Environment for the specified file or workspace. The details returned include the 1. Type of Python Environment (conda, venv, etec), 2. Version of Python, 3. List of all installed Python packages with their versions. ALWAYS call configure_python_environment before using this tool.", + "modelDescription": "This tool will retrieve the details of the Python Environment for the specified file or workspace. The details returned include the 1. Type of Python Environment (conda, venv, etc), 2. Version of Python, 3. List of all installed Python packages with their versions. ALWAYS call configure_python_environment before using this tool. This tool is only for Python environments - do not use for other programming languages.", "toolReferenceName": "getPythonEnvironmentInfo", "tags": [ "python", @@ -1528,14 +1528,13 @@ } }, "required": [] - }, - "when": "editorLangId == python || resourceLangId == python || notebookType == jupyter-notebook" + } }, { "name": "get_python_executable_details", "displayName": "Get Python Executable", "userDescription": "%python.languageModelTools.get_python_executable_details.userDescription%", - "modelDescription": "This tool will retrieve the details of the Python Environment for the specified file or workspace. ALWAYS use this tool before executing any Python command in the terminal. This tool returns the details of how to construct the fully qualified path and or command including details such as arguments required to run Python in a terminal. Note: Instead of executing `python --version` or `python -c 'import sys; print(sys.executable)'`, use this tool to get the Python executable path to replace the `python` command. E.g. instead of using `python -c 'import sys; print(sys.executable)'`, use this tool to build the command `conda run -n -c 'import sys; print(sys.executable)'`. ALWAYS call configure_python_environment before using this tool.", + "modelDescription": "This tool will retrieve the details of the Python Environment for the specified file or workspace. ALWAYS use this tool before executing any Python command in the terminal. This tool returns the details of how to construct the fully qualified path and or command including details such as arguments required to run Python in a terminal. Note: Instead of executing `python --version` or `python -c 'import sys; print(sys.executable)'`, use this tool to get the Python executable path to replace the `python` command. E.g. instead of using `python -c 'import sys; print(sys.executable)'`, use this tool to build the command `conda run -n -c 'import sys; print(sys.executable)'`. ALWAYS call configure_python_environment before using this tool. This tool is only for Python environments - do not use for other programming languages.", "toolReferenceName": "getPythonExecutableCommand", "tags": [ "python", @@ -1554,14 +1553,13 @@ } }, "required": [] - }, - "when": "editorLangId == python || resourceLangId == python || notebookType == jupyter-notebook" + } }, { "name": "install_python_packages", "displayName": "Install Python Package", "userDescription": "%python.languageModelTools.install_python_packages.userDescription%", - "modelDescription": "Installs Python packages in the given workspace. Use this tool to install Python packages in the user's chosen Python environment. ALWAYS call configure_python_environment before using this tool.", + "modelDescription": "Installs Python packages in the given workspace. Use this tool to install Python packages in the user's chosen Python environment. ALWAYS call configure_python_environment before using this tool. Do NOT use this tool to install npm or other non-Python packages.", "toolReferenceName": "installPythonPackage", "tags": [ "python", @@ -1590,13 +1588,12 @@ "required": [ "packageList" ] - }, - "when": "editorLangId == python || resourceLangId == python || notebookType == jupyter-notebook" + } }, { "name": "configure_python_environment", "displayName": "Configure Python Environment", - "modelDescription": "This tool configures a Python environment in the given workspace. ALWAYS Use this tool to set up the user's chosen environment and ALWAYS call this tool before using any other Python related tools or running any Python command in the terminal.", + "modelDescription": "This tool configures a Python environment in the given workspace. ALWAYS Use this tool to set up the user's chosen environment and ALWAYS call this tool before using any other Python related tools or running any Python command in the terminal. This tool is only for Python environments - do not use for other programming languages.", "userDescription": "%python.languageModelTools.configure_python_environment.userDescription%", "toolReferenceName": "configurePythonEnvironment", "tags": [ @@ -1615,8 +1612,7 @@ } }, "required": [] - }, - "when": "editorLangId == python || resourceLangId == python || notebookType == jupyter-notebook" + } }, { "name": "create_virtual_environment",