Skip to content

Add built-in tools to AIShell #394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

daxian-dbw
Copy link
Member

@daxian-dbw daxian-dbw commented Jul 3, 2025

PR Summary

This PR exposes built-in tools to agents of AIShell. The built-in tools are also exposed as AIFunction instances so they can be consumed similarly as the MCP client tools.
The detailed changes are:

  1. Updated the channel between the AIShell module and aish app to support retrieving context information from the connected PowerShell session. The supported context information includes:

    • CurrentLocation
    • CommandHistory
    • TerminalContent
    • EnvironmentVariables
  2. Updated the AIShell module to

    • keep track of the "current location" and "command history" using Runspace.AvailabilityChanged and InvokeCommand.LocationChangedAction events.
    • support retrieving terminal window content on Windows using screen scraping.
    • support get environment variables and their values (value for a sensitive env var is redacted)
  3. Added the BuiltInTool type that inherits AIFunction. This type has the implementation for both the discovery and invocation of the built-in tool. Built-in tools all depend on a connected PowerShell session being available, so today, for the standalone aish, no built-in tools are available. The following built-in tools are supported with this PR:

    • get_current_location
    • get_command_history
    • get_terminal_content
    • get_environment_variables
    • copy_text_to_clipboard
    • post_code_to_terminal

    run_command_in_terminal and get_terminal_output will come in a separate PR.

  4. Updated McpManager to expose built-in tools to agents, and call built-in tools as needed.

  5. Updated Host to show built-in tools along with available MCP servers/tools.

@StevenBucher98
Copy link
Collaborator

Love the tools! Few questions/thoughts

  • Can these tools be consumed by other MCP clients if say the AI Shell module started the local MCP service?
  • Does it make sense for 'get_current_location' to be more descriptive like get_current_working_directory or just get_directory, I suggest only for more relevant context to the AI provider.
  • In the same vein as above, does get_powershell_command_history for get_command_history, mainly just seeing how these can also be utilized else where to help other MCP clients get more connected with PS session etc, however I also get it adds weird complexities with say connecting a PS MCP server to VSCode for example, like which PS session etc?
  • Does Get_environment_variable get other variables in the current session too or do you think that needs to be its own thing?
  • Feels like a get_last_error may make sense to implement too so I could ask AI Shell the question "Help me fix this last error" and it would know what to do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants