Skip to content

Enhance Start-IshRemoteMcpServer with progressive disclosure of Mcp Tools #233

@ddemeyer

Description

@ddemeyer

Continuation of #213, the introduction of ISHRemoteMcpServer which has been used by many as a Prelease on the PowerShellGallery, even mentioned on https://community.rws.com

The challenge is that upon start of the PowerShell-based McpServer, the LLM needs to process around 400Kb of data generated for the around 87 Mcp Tools (ahum cmdlets) holding Get-Help input like

  • NAME, SYNOPSIS, DESCRIPTION
  • SYNTAX which explains the difference between optional and mandatory parameters per parameter set
  • PARAMETERS
  • EXAMPLES

The idea is to reduce the initial token usage to only give a shallow Mcp Tool description except for some important cmdlets like

  1. Get-Help, basic PowerShell, which instructs the LLM
  2. New-IShSession

The Model Context Protocol describes an Mcp Tool by

  • name
  • description, which so far concatenates DESCRIPTION, SYNOPSIS, SYNTAX (mandatory parameters), EXAMPLES
  • annotations; holds the hints if the cmdlet is destructive or idempotent which is important for autorunning
  • inputSchema; holds the PARAMETERs description except if they are mandatory for the parameter set (only visible in SYNTAX)
  • returns; by default a string for the LLM

Actions...

  • Add alpha release Pesters Tests like Register-IshRemoteMcpTool.Tests.ps1 to check and test if backward compatibility with the Prelease is possible.
  • Add Register-IshRemoteMcpInstructions.Tests.ps1 to check for some content
  • Add Invoke-IshRemoteMcpHandleRequest.Tests.ps1 with dummy Json values. Make sure to mock $Request with properties id/method and params
  • Split parameter FunctionName of Register-IshRemoteMcpTool to FunctionNamePartialLoad and FunctionNameFullLoad
    • Where PartialLoad means skip EXAMPLES, PARAMETERS? ... reduced from 280k to 44k
  • Parameter CmdletsToRegister of Start-IshRemoteMcpServer will become PartialLoad, adding optional parameter CmdletsToRegisterFullLoad for old behavior. This second parameter gets above list like Get-Help and New-IShSession and make sure that these are not double loaded (by removing them from CmdletsToRegister).
  • Extend all scripts with PowerShell help node at the top
  • Adapt instructions to instruct LLM on progressive discovery ...seemingly not need
  • Extend Write-IshRemoteLog with extra big if ($script:logFilePath) to check for $null or empty string (''). Best to add a simple WriteIshRemoteLog.Tests.ps1 to verify for errors.
  • Adapt ReleaseNotes-ISHRemote-8.2.md to explain the progressive behavior reducing token count and how previous behavior can be used.
  • Release build should not contain any *.Tests.ps1 files

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions