Skip to content

Register‑ShpTool

Raimund edited this page Jun 12, 2026 · 1 revision

SYNOPSIS

Registers a PowerShell command as a user-defined tool for Invoke-Shp.

SYNTAX

Register-ShpTool [-Command] <String> [[-ToolName] <String>] [[-Description] <String>] [-PassThru]
 [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

Exposes any PowerShell command (function, cmdlet, or alias) to the model as a callable tool. The command's parameter metadata is turned into a tool JSON schema, and the registration is held in a module-scoped registry that Invoke-Shp offers to the model alongside its built-in tools. When the model calls the tool, Invoke-Shp invokes the backing command with the supplied arguments and returns its output to the model.

Registered tools are session-scoped and opt-in: they exist only for the current PowerShell session and are offered only after you register them. Because a tool runs real PowerShell with your privileges, register only commands you trust and disable them (Invoke-Shp -DisableUserTools) for untrusted prompts. Re-registering the same name overwrites it.

EXAMPLES

EXAMPLE 1

Register-ShpTool -Command Get-Process

Lets the model call Get-Process as a tool in subsequent Invoke-Shp runs.

EXAMPLE 2

Register-ShpTool -Command Get-Weather -Description 'Get the weather for a city.'

Registers a custom function with an explicit description.

PARAMETERS

-Command

The command to expose (function, cmdlet, or alias). Mandatory. Accepts pipeline input.

Type: String
Parameter Sets: (All)
Aliases: Name

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-Description

The tool description shown to the model. Defaults to the command's help synopsis.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-PassThru

Return the registered tool record.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ToolName

The tool name shown to the model. Defaults to the command name.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

None by default; the registered tool record when -PassThru is used.

NOTES

RELATED LINKS

Get-ShpTool

Unregister-ShpTool

Clone this wiki locally