AI Tools (MCP)

2 votes

avatar

While playing around with the MCP Server, I really wish these things were possible:


New Parameters for New-PSUAITool

  1. -Module and -Command like in Endpoints
  2. -Scriptblock {} to have the code inside the aitools.ps1 file.
  3. -Endpoint to use a endpoint instead of a script (Max wait time would need to be 60 or lower as a max)
  4. -ArchiveJobAfterCompletion to automatically archive the script run job log after completion or retrival, currently it creates a mess in the jobs table.




New Cmdlet New-PSUAIToolResponse to add the "structured" element to the response via the mcp server.
The Idea is more or less the same as the New-PSUApiResponse cmdlet.

Currently the output looks like this:

{
    "content": [
        {
            "type": "text",
            "text": "Information - {\r\n  \"GivenName\": \"XXXX\",\r\n  \"Surname\": \"XXX\",\r\n  \"UserPrincipalName\": \"XXXX@XXXXX.XX\",\r\n  \"Enabled\": true,\r\n  \"SamAccountName\": \"XXXXX\",\r\n  \"SID\": {\r\n    \"BinaryLength\": XX,\r\n    \"AccountDomainSid\": \"MEH\",\r\n    \"Value\": \"XXXXXXX\"\r\n  },\r\n  \"DistinguishedName\": \"Woo Hooo\",\r\n  \"Name\": \"XXXXX\",\r\n  \"ObjectClass\": \"user\",\r\n  \"ObjectGuid\": \"GUID\",\r\n  \"PropertyNames\": [\r\n    \"DisplayName\",\r\n    \"DistinguishedName\",\r\n    \"Enabled\",\r\n    \"GivenName\",\r\n    \"mail\",\r\n    \"Name\",\r\n    \"ObjectClass\",\r\n    \"ObjectGUID\",\r\n    \"SamAccountName\",\r\n    \"SID\",\r\n    \"Surname\",\r\n    \"UserPrincipalName\"\r\n  ],\r\n  \"AddedProperties\": [],\r\n  \"RemovedProperties\": [],\r\n  \"ModifiedProperties\": [],\r\n  \"PropertyCount\": 12,\r\n  \"DisplayName\": \"XXXXX XXXX\",\r\n  \"mail\": \"XXXX@XXXX.XX\",\r\n  \"ObjectGUID\": \"XXXXXXXX\"\r\n}"
        }
    ]
}


It's fine, but being able to return a structured element inside the "content" object, would help, this would also drastically help with not needing to convert to json before returning the result.
A parameter to choose encoding could be nice, like formats like Markdown,XML,Json,Csv etc.

All Comments (3)

avatar

@AniTexs These are good suggestions. I've captured them in an issue and this topic will be updated once we implement or need any more information.

Adam Driscoll
PowerShell Expert and Developer at Devolutions

avatar

+1 from me.

I was actually considering opening a feature request for a very similar use case.

Being able to expose PSU Endpoints directly as AI Tools would be extremely useful. I have several lightweight endpoints that return data within milliseconds. Executing a script for every tool invocation introduces unnecessary overhead compared to calling an endpoint directly.

This would make PSU a much more efficient MCP/AI integration platform and enable fast, read-only data lookups without the startup cost of script execution.

avatar

In 2026.3.0, we've implemented persistent MCP tool environments. This makes them behave like APIs to avoid the startup cost of a subprocess. Once started, it will remain open and run the requests very quickly. That said, they still use the job subsystem so it will record the MCP execution in the job table, which has some overhead compared to APIs.

I've opened an issue to further enhance this feature by allow you to just turn an API into an MCP tool directly. Execution would happen similar to APIs without the job scheduler or job logging involved. You'd lose some auditing but would gain speed and may be all you need for fast, read-only MCP calls.

Adam Driscoll
PowerShell Expert and Developer at Devolutions