workflows/default/systems/mcp/tools/task-list/test.ps1

#!/usr/bin/env pwsh
param(
    [Parameter(Mandatory)]
    [System.Diagnostics.Process]$Process
)

. "$PSScriptRoot\..\..\dotbot-mcp-helpers.ps1"

function Send-McpRequest {
    param(
        [Parameter(Mandatory)]
        [object]$Request,
        [Parameter(Mandatory)]
        [System.Diagnostics.Process]$Process
    )
    
    $json = $Request | ConvertTo-Json -Depth 10 -Compress
    $Process.StandardInput.WriteLine($json)
    $Process.StandardInput.Flush()
    Start-Sleep -Milliseconds 100
    $response = $Process.StandardOutput.ReadLine()
    
    if ($response) {
        return $response | ConvertFrom-Json
    }
    return $null
}

Write-Host "Test: List all features" -ForegroundColor Yellow
$response = Send-McpRequest -Process $Process -Request @{
    jsonrpc = '2.0'
    id = 1
    method = 'tools/call'
    params = @{
        name = 'feature_list'
        arguments = @{}
    }
}
$result = $response.result.content[0].text | ConvertFrom-Json
Write-Host "✓ Found $($result.stats.total_count) total features" -ForegroundColor Green

Write-Host "`nTest: List todo features with high priority" -ForegroundColor Yellow
$response = Send-McpRequest -Process $Process -Request @{
    jsonrpc = '2.0'
    id = 2
    method = 'tools/call'
    params = @{
        name = 'feature_list'
        arguments = @{
            status = 'todo'
            max_priority = 10
            limit = 5
        }
    }
}
$result = $response.result.content[0].text | ConvertFrom-Json
Write-Host "✓ Found $($result.stats.total_count) high priority todo features" -ForegroundColor Green

Write-Host "`nTest: List core features" -ForegroundColor Yellow
$response = Send-McpRequest -Process $Process -Request @{
    jsonrpc = '2.0'
    id = 3
    method = 'tools/call'
    params = @{
        name = 'feature_list'
        arguments = @{
            category = 'core'
        }
    }
}
$result = $response.result.content[0].text | ConvertFrom-Json
Write-Host "✓ Found $($result.stats.total_count) core features" -ForegroundColor Green
if ($result.features.Count -gt 0) {
    Write-Host " First feature: $($result.features[0].name)" -ForegroundColor Gray
}