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.

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.

1 participant