Skip to content

feat(fabric): add read-only core_get-capacity tool - #3846

Merged
Amos Hersch (AmosHersch) merged 2 commits into
mainfrom
amoshersch-fabric-get-capacity
Oct 7, 2026
Merged

Amos Hersch (AmosHersch) merged 2 commits into
mainfrom
amoshersch-fabric-get-capacity

Conversation

@AmosHersch

@AmosHersch Amos Hersch (AmosHersch) commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds one read-only Fabric Core tool, core_get-capacity, as the first tool layer above the shared foundation #3855. The immediate base is amoshersch-shared-fabric-foundation at 21655d0f8af45619013675656caf4a179329e261; the ultimate base is main. The foundation also includes the tool-catalog stream fix from #3854. This preserves the existing PR number and adds no other sibling tool.

  • Calls Get Capacity: GET https://api.fabric.microsoft.com/v1/capacities/{capacityId}.
  • Requires capacity-id (--capacity-id in the CLI), validates a nonempty UUID before authentication/network access, and canonicalizes the request ID.
  • Returns source-generated, typed { capacity: { id, displayName, sku, region, state } } output. All five fields are required; SKU, region, and state accept future string values. Invalid, incomplete, or mismatched responses are rejected rather than turned into empty success.
  • Reuses the foundation's SendFabricHttpRequestAsync with explicit ResponseHeadersRead and named cancellation, FabricCoreHttpHelpers.GetRetryAfter, shared FabricCapacityMetadata.IsValid, and FabricCoreHttpMessageHandler. There is no duplicate capacity DTO/context registration or operation-specific HTTP test-handler copy.
  • Preserves HTTP failure statuses, sanitized messages/results/logging, operation-specific FabricCapacityGetThrottledException guidance without retries, cancellation, and response/stream disposal.
  • Preserves existing Core create/search behavior and host credential composition, including the provider-delegating credential. No ARM/subscription/billing calls, capacity mutations, workspace assignments, LROs, authentication redesign, or project/dependency changes. The inherited shared foundation and engineering files are unchanged by this layer.
  • Adds offline command/service/schema/registered-MCP coverage, Fabric README guidance and selection prompts, and a Fabric changelog entry. Cumulative Core tools are exactly core_create-item, core_get-capacity, and core_search-catalog.

Validation

Re-run against the combined branch at 3fe213e152d26da952e28160f7bbfdfbd0390dd7:

Command Result
dotnet build tools\Fabric.Mcp.Tools.Core\src --nologo --verbosity quiet Passed; 0 warnings, 0 errors.
dotnet build tools\Fabric.Mcp.Tools.Core\tests\Fabric.Mcp.Tools.Core.Tests --nologo --verbosity quiet Passed; 0 warnings, 0 errors.
dotnet test --project tools\Fabric.Mcp.Tools.Core\tests\Fabric.Mcp.Tools.Core.Tests\Fabric.Mcp.Tools.Core.Tests.csproj --no-build --no-restore Passed: 230 tests, 0 failed, 0 skipped, including all inherited foundation/create/search tests.
dotnet build servers\Fabric.Mcp.Server\src --nologo --verbosity quiet Passed; 0 warnings, 0 errors.
.\servers\Fabric.Mcp.Server\src\bin\Debug\fabmcp.exe tools list --name-only Passed: 49 Fabric tools; exact three-tool Core catalog asserted. No Fabric service call.
Invoke-Pester -Path .\eng\scripts\Test-ToolSelectionPrompts.Tests.ps1 -PassThru -Output Detailed Passed: 5 tests, 0 failed/skipped. Pester 5.7.1 was loaded from session-local storage because the system Pester 3.4.0 is incompatible; repository dependencies were not changed.
.\eng\scripts\New-BuildInfo.ps1 -ServerName Fabric.Mcp.Server -PublishTarget none -BuildId 12345 Passed; generated Fabric-only local build metadata.
dotnet build servers\Fabric.Mcp.Server\src --no-restore --nologo --verbosity quiet --output .\.work\capacity-stack-catalog\Fabric.Mcp.Server\windows-x64 Passed; 0 warnings, 0 errors. Built this branch's catalog in the validator's expected layout.
.\eng\scripts\Test-ToolSelectionPrompts.ps1 -ServerName Fabric.Mcp.Server -SkipServerBuild -OutputPath .\.work\capacity-stack-catalog Passed: 49 tools loaded, 1 server tested, 0 skipped, 0 violations. Real DataFactory stderr diagnostics remained visible without contaminating catalog JSON.
.\eng\scripts\Process-PackageReadMe.ps1 -Command validate -InputReadMePath .\servers\Fabric.Mcp.Server\README.md Exited 0 with 14 pre-existing TOC heading-level warnings. Headings and TOC were verified unchanged from the foundation.
git diff --check 21655d0f8af45619013675656caf4a179329e261 HEAD Passed.

Formatting passed for the 13 C# files changed by this layer:

$files = @(git diff --name-only '21655d0f8af45619013675656caf4a179329e261' 'HEAD' -- '*.cs' | ForEach-Object { $_.Replace('/', '\') })
dotnet format tools\Fabric.Mcp.Tools.Core\src\Fabric.Mcp.Tools.Core.csproj --no-restore --verify-no-changes --include $files --verbosity quiet
dotnet format tools\Fabric.Mcp.Tools.Core\tests\Fabric.Mcp.Tools.Core.Tests\Fabric.Mcp.Tools.Core.Tests.csproj --no-restore --verify-no-changes --include $files --verbosity quiet

Spelling passed for all 17 layer files, with 0 issues:

$files = @(git diff --name-only '21655d0f8af45619013675656caf4a179329e261' 'HEAD' | ForEach-Object { $_.Replace('/', '\') })
$cache = Join-Path $env:TEMP ('fabric-capacity-stack-' + [guid]::NewGuid().ToString('N'))
.\eng\common\spelling\Invoke-Cspell.ps1 -FileList $files -PackageInstallCache $cache

The previously generated, schema-validated Get Capacity changelog entry is unchanged. Exact comparisons also confirm that the foundation's shared helpers, DTO, tests, and inherited catalog-stream fix are unchanged by this layer.

Coverage boundaries and pending validation

Offline coverage includes invalid and unexpected arguments before authentication, exact request URI/headers/scope, all required response fields, future string values, unknown-property exclusion, malformed responses, status preservation, safe retry guidance, cancellation/disposal, per-request credentials, and create/search regressions. Registered handlers exercise read-only discovery and default/compact/duplicated output; HTTP runtime configuration does not constitute a real HTTP/OBO test.

Live Fabric calls, real OBO authorization, service-principal/managed-identity access, and recorded playback are unexercised. Live/recorded infrastructure is outside this scoped change. ToolDescriptionEvaluator was not run. The Fabric MCP maintainer waived the score/ranking requirement for this PR in this review reply; no score or top-three ranking is claimed. Broad package/native suites were not run. The shared prompt validator and its stream-regression tests now pass locally on the inherited fix; this does not claim hosted CI success. Normal required CI and maintainer review still apply.

GitHub issue number?

No tracking issue was provided; none was created.

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history is clean with descriptive messages (cleanup guide)
    • Added comprehensive tests for new/modified functionality
    • Created a changelog entry if the change falls among the following: new feature, bug fix, UI/UX update, breaking change, or updated dependencies. Follow the changelog entry guide
  • For MCP tool changes:
    • One tool per PR: This PR adds or modifies only one MCP tool for faster review cycles
    • Updated servers/Azure.Mcp.Server/README.md and/or servers/Fabric.Mcp.Server/README.md documentation
    • Validate README.md changes running the script ./eng/scripts/Process-PackageReadMe.ps1. See Package README
    • For new or modified tool descriptions, ran ToolDescriptionEvaluator and obtained a score of 0.4 or more and a top 3 ranking for all related test prompts — Not run; waived for this PR by the Fabric MCP maintainer (see review reply above).
    • For tools with new names, including new tools or renamed tools, update consolidated-tools.json
    • For renamed tools, follow the Tool Rename Checklist and tag the PR with the breaking-change label
    • For new tools associated with Azure services or publicly available tools/APIs/products, add URL to documentation in the PR description
  • Extra steps for Azure MCP Server tool changes:

The rename and Azure-only items are not applicable. Fabric uses NullConsolidatedToolDefinitionProvider, so this PR does not modify Azure's consolidated inventory. ToolDescriptionEvaluator was not run; its score/ranking requirement is waived for this PR as documented above. Required CI and normal review remain applicable.

Invoking Livetests

Copilot submitted PRs are not trustworthy by default. Users with write access to the repo need to validate the contents of this PR before leaving a comment with the text /azp run mcp - pullrequest - live. This will trigger the necessary livetest workflows to complete required validation.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions github-actions Bot added the server-Fabric.Mcp Microsoft Fabric MCP Server label Oct 5, 2026
@AmosHersch
Amos Hersch (AmosHersch) force-pushed the amoshersch-fabric-get-capacity branch from 9643019 to 3fe213e Compare October 5, 2026 21:02
@AmosHersch
Amos Hersch (AmosHersch) changed the base branch from main to amoshersch-shared-fabric-foundation October 5, 2026 21:03
@AmosHersch
Amos Hersch (AmosHersch) force-pushed the amoshersch-fabric-get-capacity branch from 3fe213e to 8706aaa Compare October 6, 2026 08:34
Base automatically changed from amoshersch-shared-fabric-foundation to main October 6, 2026 12:28
@AmosHersch
Amos Hersch (AmosHersch) force-pushed the amoshersch-fabric-get-capacity branch from 8706aaa to 286a0dd Compare October 6, 2026 12:28
@AmosHersch
Amos Hersch (AmosHersch) marked this pull request as ready for review October 6, 2026 12:29
@AmosHersch
Amos Hersch (AmosHersch) requested a review from a team as a code owner October 6, 2026 12:29
Copilot AI balanced review requested due to automatic review settings October 6, 2026 12:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Prompt interactions are malformed and required ToolDescriptionEvaluator evidence remains pending.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds the read-only Fabric Core core_get-capacity tool with typed responses, validation, documentation, and offline tests.

Changes:

  • Implements and registers capacity retrieval.
  • Adds comprehensive command, service, and MCP tests.
  • Updates prompts, documentation, and changelog.
File Description
.../​TestSupport/​CapacityGetTestData.cs Adds shared test fixtures.
.../​Services/​CapacityGetServiceTests.cs Tests HTTP and response handling.
.../​tests/​.../​README.md Documents test coverage.
.../​FabricCoreSetupTests.cs Verifies registration.
.../​Commands/​CapacityGetCommandTests.cs Tests command behavior.
.../​CapacityGetMcpTests.cs Tests registered MCP behavior.
.../​Services/​IFabricCoreService.cs Adds service contract.
.../​Services/​FabricCoreService.cs Implements capacity retrieval.
.../​Services/​FabricCapacityGetThrottledException.cs Adds throttling guidance.
.../​Options/​CapacityGetOptions.cs Defines capacity ID input.
.../​Models/​CoreJsonContext.cs Registers result serialization.
.../​Models/​CapacityGetCommandResult.cs Defines typed result.
.../​FabricCoreSetup.cs Registers and exposes command.
.../​Commands/​CapacityGetCommand.cs Implements the MCP command.
servers/​Fabric.Mcp.Server/​README.md Documents operational tools and usage.
servers/​Fabric.Mcp.Server/​docs/​e2eTestPrompts.md Adds selection prompts.
.../​changelog-entries/​amoshersch-fabric-core-get-capacity.yaml Records the feature.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@AmosHersch
Amos Hersch (AmosHersch) force-pushed the amoshersch-fabric-get-capacity branch from add904c to 01da3d0 Compare October 7, 2026 07:52
@AmosHersch
Amos Hersch (AmosHersch) merged commit b59b6a6 into main Oct 7, 2026
20 checks passed
@AmosHersch
Amos Hersch (AmosHersch) deleted the amoshersch-fabric-get-capacity branch October 7, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server-Fabric.Mcp Microsoft Fabric MCP Server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants