MCP Error: "Error: MPC -32603: An error occurred."

MCP Error: "Error: MPC -32603: An error occurred."

avatar

PSU 2026.1.6

Somehow the codeword "Port" results in the PSU MCP tools to do inexplicable things. I can define Port as String or Int, it always gets treated as Int. Same with the Codeword: I can use Port or PortString or anything with Port in the name, it gets cut internally into "Port", even if Port exists nowhere and the real parameter is PortString.

This problem reminds me of the other bugs I opened where the codeword IP results in inexplicable behaviours.

The call doesn't even get converted into a job run.

Get-MCPPortConnectionCheck.ps1:

<#
.SYNOPSIS
    Test remote IP connectivity by port
.DESCRIPTION
    Test remote IP connectivity by port from a specific server, return the connection result
.PARAMETER Servername
    Name of source server
.PARAMETER TargetIP
    Target IP address to check connection
.PARAMETER Port
    Target port to check connection
#>
function Get-MCPPortConnectionCheck {
    param (
        [Parameter(Mandatory = $true, HelpMessage = 'Name of source server')]
        [String]
        $Servername,
        [Parameter(Mandatory = $true, HelpMessage = 'Target IP address to check connection')]
        [String]
        $TargetIP,
        [Parameter(Mandatory = $true, HelpMessage = 'Target port to check connection')]
        [String]
        $Port
    )


MCP log:

2026-06-09 08:55:07.040 [info] [editor -> server] {"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"Test_remote_IP_connectivity_by_port","arguments":{"Servername":"REDACTED","TargetIP":"REDACTED","Port":53},"_meta":{"progressToken":"REDACTED","vscode.conversationId":"REDACTED","vscode.requestId":"REDACTED","traceparent":"REDACTED"}}}
2026-06-09 08:55:07.064 [info] [server -> editor] {"error":{"code":-32603,"message":"An error occurred."},"id":4,"jsonrpc":"2.0"}


Output in chat:
Error: MPC -32603: An error occurred.


Now, this magically works:

$Parameters = @{
    Module            = 'psu_mcp_tools'
    Command           = 'Get-MCPPortConnectionCheck'
    Description       = 'Test remote IP connectivity by textstring'
    InformationAction = 'SilentlyContinue'
    ErrorAction       = 'Stop'
}
New-PSUScript @Parameters


$Parameters = @{
    Name           = 'Test remote IP connectivity by textstring'
    Description    = 'Test remote IP connectivity by textstring from a specific server, return the connection result'
    ScriptFullPath = 'psu_mcp_tools\Get-MCPPortConnectionCheck'
    Authenticated  = $true
    Role           = @('Reader')
}
New-PSUMcpTool @Parameters


<#
.SYNOPSIS
    Test remote IP connectivity by port
.DESCRIPTION
    Test remote IP connectivity by port from a specific server, return the connection result
.PARAMETER Servername
    Name of source server
.PARAMETER TargetIP
    Target IP address to check connection
.PARAMETER TextString
    Target port to check connection send as PORT:portnumber, example PORT:3389
#>
function Get-MCPPortConnectionCheck {
    param (
        [Parameter(Mandatory = $true, HelpMessage = 'Name of source server')]
        [String]
        $Servername,
        [Parameter(Mandatory = $true, HelpMessage = 'Target IP address to check connection')]
        [String]
        $TargetIP,
        [Parameter(Mandatory = $true, HelpMessage = 'Target port to check connection send as PORT:portnumber, example PORT:3389')]
        [String]
        $TextString
    )

    $Port = $TextString.Split(':')[-1]

All Comments (1)

avatar

@schubfre That is very strange and does seem similar to the other item to mentioned. I do wonder if they are somehow related. I haven't had a chance to try this yet.

Adam Driscoll
PowerShell Expert and Developer at Devolutions