Add built-in tools to AIShell #394
Merged
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
AIFunctioninstances so they can be consumed similarly as the MCP client tools.The detailed changes are:
Updated the channel between the
AIShellmodule andaishapp to support retrieving context information from the connected PowerShell session. The supported context information includes:CurrentLocationCommandHistoryTerminalContentEnvironmentVariablesUpdated the
AIShellmodule toInvokeCommand.LocationChangedActionandRunspace.AvailabilityChangedevents.Added the
BuiltInTooltype 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_working_directoryget_command_historyget_terminal_contentget_environment_variablescopy_text_to_clipboardpost_code_to_terminalrun_command_in_terminalandget_terminal_outputwill come in a separate PR.Updated
McpManagerto expose built-in tools to agents, and call built-in tools as needed.Updated
Hostto show built-in tools along with available MCP servers/tools.Updated
Invoke-AIShellto allow passing in the query message withReadLinecall, so that a query message doesn't need to be enclosed in double/single quotes.