Skip to content

Add in-memory content support to build_bicep, build_bicepparam, and format_bicep_file#19644

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/update-bicep-file-diagnostics
Draft

Add in-memory content support to build_bicep, build_bicepparam, and format_bicep_file#19644
Copilot wants to merge 4 commits into
mainfrom
copilot/update-bicep-file-diagnostics

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 14, 2026

build_bicep (the renamed diagnostics tool) and format_bicep_file previously required on-disk files, which made LLM-generated, in-memory Bicep flows awkward. This change adds first-class in-memory payload support and brings build_bicepparam to parity.

  • MCP compiler/formatter input model

    • Updated build_bicep, build_bicepparam, and format_bicep_file to accept optional content alongside filePath.
    • Supported call modes:
      • filePath only: existing disk-based behavior.
      • content only: compile/format entirely in-memory.
    • Added validation to reject ambiguous input when both filePath and content are provided.
  • Compilation path changes

    • Added shared compilation helper in BicepCompilerTools that:
      • validates minimum input (filePath or content required),
      • validates mutual exclusivity (filePath and content cannot both be provided),
      • preserves extension/type checks,
      • creates an in-memory workspace entry when content is supplied.
  • Tool contract and discoverability

    • Updated MCP tool descriptions and JSON schemas (tools.json) to document one-or-the-other input semantics.
    • Updated docs to reflect current tool naming (build_bicep) and in-memory support, including build_bicepparam.
  • Focused coverage updates

    • Added/updated unit tests for:
      • in-memory formatting,
      • in-memory build_bicep,
      • in-memory diagnostics behavior for build_bicepparam,
      • validation when both filePath and content are provided.
// in-memory bicep build
var result = await tools.BuildBicep(content: """
param location string = 'westus'
output loc string = location
""");

// path-based bicepparam build
var result2 = await tools.BuildBicepparam("/repo/main.bicepparam");

> [!WARNING]
>
>

Copilot AI and others added 2 commits May 14, 2026 12:04
Agent-Logs-Url: https://github.com/Azure/bicep/sessions/7bff4607-7972-41e3-b1a0-fb820beef2eb

Co-authored-by: anthony-c-martin <38542602+anthony-c-martin@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Azure/bicep/sessions/7bff4607-7972-41e3-b1a0-fb820beef2eb

Co-authored-by: anthony-c-martin <38542602+anthony-c-martin@users.noreply.github.com>
Copilot AI changed the title [WIP] Update bicep file formatting and diagnostics to support in-memory strings Add in-memory content support to build_bicep, build_bicepparam, and format_bicep_file May 14, 2026
Copilot AI requested a review from anthony-c-martin May 14, 2026 12:09
Comment thread src/Bicep.McpServer.Core/BicepCompilerTools.cs Outdated
Agent-Logs-Url: https://github.com/Azure/bicep/sessions/49eca429-ab6f-46c4-84ca-45462ca10a14

Co-authored-by: anthony-c-martin <38542602+anthony-c-martin@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 14, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • aka.ms
    • Triggering command: /tmp/dotnet-10.0.300/dotnet /tmp/dotnet-10.0.300/dotnet exec /home/REDACTED/work/bicep/bicep/src/Bicep.McpServer.UnitTests/bin/Debug/net10.0/Bicep.McpServer.UnitTests.dll --internal-msbuild-node /tmp/717ad653bc70455ab94f7768b1e51d88/.p --ignore-exit-code 8 --filter FullyQualifiedName~Bicep.McpServer.UnitTests.BicepCompilerToolsTests (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

get_bicep_file_diagnostics , format_bicep_file Should take in in-memory string arguments.

2 participants