✨ feat: enhance tool filtering and specification handling#1443
Merged
Conversation
Introduce filtering of tools based on specifications, add intent support.
Ensure an error is thrown when a tool's intent is not found.
- Updated intent description handling to trim whitespace.
pelikhan
added a commit
that referenced
this pull request
Apr 15, 2025
* 🐛: Handle unknown reference types in state logging Added logging for unknown reference types in activateChatParticipant. * note about dev (#1410) * add support for dev branch * Enhance schema validation with new utilities (#1412) * ✨ refactor: enhance schema validation with new utilities Introduce tryValidateJSONWithSchema and integration with parsers. * added docs * updated tests * updated prd * docs * caution * Update CONTRIBUTING.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * add examples of warnings * ✨ enhance: Add support for GitHub Markdown annotations parsing Improve diagnostic handling by adding support for parsing GitHub Flavored Markdown annotations such as WARNING and CAUTION, mapping severities, and refining output formats. New tests added to validate functionality. * Release 1.124.3 * [skip ci] updated version numbers * ast-grep blog post * image * update blog * run docs from dev * blog post fixes * Cli-run-help (#1416) * help cli for scripts * add sparc rules * fixes to support dev * output trace again * Update .github/workflows/docs.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update docs/src/content/docs/reference/scripts/files.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * check fetch errors * refresh lock file * remove hono test * more docs on logger * enable dotenv debug mode when /dotent/ * missing space * consistent script selection experience * fix for #1357 * basic types for chat messages fix for #1347 * fixing typos * type issue * fixing tests * updated guidance * Refactor URL handling and enhance logging features (#1420) * base script * time log * applyed to assert * format file * added logging * ✨ refactor URL handling and enhance logging Redesigned ellipseUri to redactUri and improved debugging logs. * ✨ feat: Enable default application of edits Set the `applyEdits` parameter default to true for improved usability. * update branches * fix docs * Release 1.124.4 * [skip ci] updated version numbers * ✨ enhance: improve usage logging and remove redundant logic Updated logging with verbose details and removed duplicate updates. * fix for #1419 * mcp servers and agents support (#1421) * fix mcp client * use headless * updated samples * builtin mcp support * typo * docs * ✨ feat: enhance McpServerConfig with flexible command options - Updated command in McpServerConfig to accept OptionsOrString types. * updated docs * ✨: Add MCP Agents blog post and related assets - Introduced a new blog post on MCP Agents featuring configuration options. - Added an illustrative cover image `mcp-agents.png` for the blog post. * ✨ feat: add maxTokens support across MCP configurations Introduce maxTokens parameter to enhance tool response control. Updated constants, types, and scripts for integration. * Release 1.125.0 * [skip ci] updated version numbers * add rust to dev image * ✨: Add Z3 solver integration for SMTLIB2 problem solving Integrated Z3 solver for handling SMTLIB2 queries and added examples. * 3rd party license update * add z3 tool * added z3 agent * fix link * install steup * fix links * refresh lockfiles * 🔥 Remove unused references to Z3 setup instructions Removed setup instructions from docs and unused imports in code. * updated mdx * Release 1.125.1 * [skip ci] updated version numbers * blog icon * handle missing duration * Release 1.125.2 * [skip ci] updated version numbers * updated instructions * added developer guide * Add markdown/text conversion feature in fetchText (#1426) * builtin convert markdown/text feature in fetchText * add docs * fix docs * more languages * stack graph example * fix name matching * Dev-build-script (#1430) * add build.mjs * more known words * reorder externals * refresh deps * more logging for prr * added tool_choice * ✨ Enhance tool choice handling in chat execution Refined tool selection logic by adding fallback checks. * agent-agent * large-image example * ✨ Add support for image encoding and streamlined append logic Enhanced image handling with encoding, cancellation support, and cleanup. * updated docs * support for gists (#1436) * adding resources * support for gists * remove size issue * docs * fix extension typos * don't resolve content * fix resolution of gists * missing docs * 🐛 fix: handle undefined cases in url redaction Ensured `redactUri` returns undefined for invalid URLs. * ✨ Improve duration placement and log output formatting - Adjusted `prettyDuration` placement for consistency and clarity. * whitespace * add gist blog post * ✨: Enhance Gist integration and documentation Expanded Gist URL support and added related documentation links. * Release 1.126.0 * [skip ci] updated version numbers * 🔧 chore: update external dependencies list in build config Updated the external array to include "vscode", "pdfjs-dist", and "skia-canvas". * ✨ Refactor HTMLEscape import structure Centralized HTMLEscape functionality in a new module. Updated references. * Release 1.126.1 * [skip ci] updated version numbers * updated isntructions * fix dependcies * Release 1.126.2 * [skip ci] updated version numbers * blog icon * Release 1.126.3 * [skip ci] updated version numbers * add gist video * fix video id * remove old script * more prices * ✨ feat: enhance cache handling with filename sanitization Added `sanitizeFilename` usage to improve path safety and cleanliness. * add gist test * ♻️ Refactor fetch-related functionality and fixes Moved fetchText and traceFetchPost to fetchtext. Fixed typos. * typo * ✨ feat: fix typo in Jinja2 command documentation and add docify and prettier functions * added excerts to blog * add dotjs blog post * upgrade a few deps * work around rss * typo * ✨ feat: add URL module imports across core and cli - Introduced "URL" from "node:url" to enhance URL handling. * Release 1.126.4 * [skip ci] updated version numbers * 🔧 refactor: replace "url" module with "node:url" Updated imports to use "node:url" for consistency and clarity. * Release 1.126.5 * ✨ refactor URL handling and introduce uriTryParse Replaced redactUri with uriRedact and added uriTryParse for parsing. * ✨ Enhance CLI documentation and options handling Updated documentation for various CLI methods; added options clarification. * Release 1.126.6 * [skip ci] updated version numbers * ✨ refactor token debugging for clarity Refactored token resolution debugging to handle null cases. * excerpts in blogs (#1440) * add excerpts * refresh deps * updated prr/prd * remove mcp mode check * setup mcp on main solution * ✨ feat: extend PromptSystemOptions for safety controls Integrated PromptSystemSafetyOptions into PromptSystemOptions. * add toolsSha feature in mcp * ✨ Add support for pinning MCP server package versions Added guidance and example for pinning MCP server versions via `npx`. * ✨ feat: add SecretDetectionOptions to enhance security Added SecretDetectionOptions alongside ContentSafetyOptions for robust safety. * content safety for tools (#1441) * validating tool outputs * help to resolve content safety service * added content safety to tools * docs * finish wiring * typo * adding blog * comments * Release 1.127.0 * [skip ci] updated version numbers * ✨ feat: add role parameter for system in writeText Support for specifying role as "system" in writeText method added. * ✨ Make SARIF diagnostics conversion asynchronous Refactored SARIF conversion to async and optimized imports for clarity. * ✨ Add `--no-output-trace` flag and GitHub Gists support Introduced CLI flag to disable output trace generation. Added GitHub Gists listing functionality and improved gist fetching with rich metadata. * hide "fix types" from run menu * ✨ feat: enhance tool filtering and specification handling (#1443) * ✨ feat: enhance tool filtering and specification handling Introduce filtering of tools based on specifications, add intent support. * example of pawning * typo * plumbing * passign generator around * intent added * describe intent * adding commit * ✨ feat: add validation for missing tool intent Ensure an error is thrown when a tool's intent is not found. * ✨: Ensure intent descriptions are properly trimmed - Updated intent description handling to trim whitespace. * mcp server intent * update docs * ♻️ Refactor tool handling logic in core and sample files Simplified tool definitions by removing AgenticTool variants. * Release 1.128.0 * [skip ci] updated version numbers * ✨ Add MCP Intent Validation blog post and updates Introduce MCP Intent Validation with examples and updated tools. * updated test * add preferred responseType (#1444) * better default in strategy for json schemas * add default * fixing script resolution in extension (#1449) * removing duplicate state * move fix command to self file * further cleanup * cleanup in various files * rename * fix type * more cleanup * clean logic * no sideeffect in getting project * ✨ refactor state management and cleanup parsing logic Removed redundant state parsing logic for improved clarity and efficiency. * fix gists * 🎨 refactor: enforce script presence before cancellation Ensure script existence is validated prior to cancelAll invocation. * ✨ chore: update .gitattributes for line endings Implemented consistent line endings for text files across platforms. * add grumpy dev * Release 1.128.1 * [skip ci] updated version numbers * Multi-file-selection (#1452) * support for running on multiple selected files * ✨ feat: enhance file handling and debug setup Improved file filtering, debugging, and added a new sample script. * add link * Release 1.128.2 * [skip ci] updated version numbers * gpt-4.1 support (#1453) * configure openai default ot gpt-4.1 * fix pricing lookup * ✨ Add support for GPT-4.1 and associated pricing - Introduced "gpt-4.1" model with aliases and pricing details. * Release 1.129.0 * [skip ci] updated version numbers * max_tokens -> max_completion_tokens * adding annotations to exposed tools (#1455) * adding annotations docs * 🚀 refactor: optimize MCP client initialization Reordered debug initialization and removed unused params. Enhanced server config. * redacting secrets in tool outputs * ✨ enhance: Add content safety and intent fields - Introduced new fields for content safety and intent metadata. * testing more mcps * enabling a few more tools in mcp * refresh scripts * ✨ feat: improve MCP tool descriptions and server warnings Enhanced script descriptions to guide LLM tool selection. Added server warning for missing script descriptions, ensuring clearer functionality. * description requirements * typos * clean out gpt-3.5-turbo * a few blog drafts * add arguments * ✨: Update blog generator and core path functionalities Improved file handling, added sanitize function, and adjusted file extensions. * Release 1.129.1 * [skip ci] updated version numbers * fix think tool * updated deps * fix handling of 'run genaiscript' from title window * clean out drafts * Release 1.129.2 * [skip ci] updated version numbers * notify ui that we are starting the server terminal * set running state when client connected * Release 1.129.3 * [skip ci] updated version numbers * added video * ✏️ fix: clarify behavior of TRACE_DETAILS event Updated comment to specify that TRACE_DETAILS flushes if open. * support command palette * 🛠️ update: Upgrade Azure AI API to 2025-03-01-preview Updated Azure AI Inference API version for future compatibility. * ✨ Fix logging typo and refine Azure env logic - Corrected a logging typo and improved Azure API version handling. * removing . escaping in azure model names * ✏️ improve: link Azure OpenAI API version documentation Added a hyperlink to clarify default API version details. * ✨ feat: Add pricing details for Azure GPT-4.1 models Introduced pricing info for GPT-4.1 and variants in Azure services. * fix super-prompt * Release 1.129.4 * [skip ci] updated version numbers * display api version in docs * handle fixing non-gist files * adding dev scenario --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce filtering of tools based on specifications, add intent support.
Summary of Changes
This pull request introduces several enhancements and features related to tool management, intent validation, and security for GenAIScript. Here's an overview of the changes:
✨ Output Intent Validation for Tools:
intentproperty for tools and MCP servers, which can use the tool description or a custom function for validation.smallby default) for validation.🔒 Enhanced Security Features:
detectPromptInjectionandintentoptions to MCP server configurations to strengthen protection against prompt injection and ensure tool output integrity.toolsShaproperty to support partial SHA for better readability.🛠️ Improved Tool Specification:
toolsin server configurations.📊 Visual Enhancements:
mermaiddiagrams to documentation for better visualization of security processes like signature checks and prompt injection detection.📚 Documentation Updates:
🧪 Sample Scripts:
mcp-tools-intent.genai.mtsandtool_with_intent.genai.mts) showcasing the use of intent validation and custom tool configurations.🐛 Miscellaneous Improvements:
functionstotoolsin prompt rendering and related code for consistency.These changes enhance the robustness, security, and usability of GenAIScript, particularly in tool management and validation workflows. 🚀
🚀 Here’s a high-level summary of the changes from the git diff:
🔧 Added
toMcpToolSpecificationfunction: Accepts either a string (tool name) or an existing specification and returns the same type. This is used to facilitate tool creation in McpClientManager.🎯 Updated tool handling:
New interface fields were introduced to standardize type checking in
prompt_template.d.ts:These changes solidify the public API alignment and improve type consistency throughout the codebase.