Add built-in tools to AIShell #394
Open
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.
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:
Updated the channel between the
AIShell
module andaish
app to support retrieving context information from the connected PowerShell session. The supported context information includes:CurrentLocation
CommandHistory
TerminalContent
EnvironmentVariables
Updated the
AIShell
module toRunspace.AvailabilityChanged
andInvokeCommand.LocationChangedAction
events.Added the
BuiltInTool
type that inheritsAIFunction
. 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 standaloneaish
, 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
andget_terminal_output
will come in a separate PR.Updated
McpManager
to expose built-in tools to agents, and call built-in tools as needed.Updated
Host
to show built-in tools along with available MCP servers/tools.