Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
changes:
- section: "Other Changes"
description: "Handle GitHub API rate limiting, add runtime configuration, and live tests for Azure Functions toolset"
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
]
},
{
"name": "get_azure_functions_template_info",
"description": "Get Azure Functions project templates, supported languages, and template source code for bootstrapping new Azure Functions projects.",
"name": "get_azure_functions_info",
"description": "Get Azure Functions project samples and templates, supported languages, and source code for bootstrapping new Azure Functions projects.",
"toolMetadata": {
"destructive": {
"value": false,
Expand All @@ -81,7 +81,7 @@
},
"openWorld": {
"value": false,
"description": "This tool's domain of interaction is closed and well-defined, limited to Azure Functions templates."
"description": "This tool's domain of interaction is closed and well-defined, limited to Azure Functions samples and templates."
},
"readOnly": {
"value": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
using System.Text.Json.Serialization;
using Azure.Mcp.Tools.Functions.Commands.Template;
using Azure.Mcp.Tools.Functions.Models;
using Azure.Mcp.Tools.Functions.Services;

namespace Azure.Mcp.Tools.Functions.Commands;

/// <summary>
/// AOT-safe JSON serialization context for Functions commands, CDN manifest, and GitHub API.
/// </summary>
[JsonSerializable(typeof(LanguageListResult))]
[JsonSerializable(typeof(List<LanguageListResult>))]
[JsonSerializable(typeof(ProjectTemplateResult))]
Expand All @@ -17,5 +21,9 @@ namespace Azure.Mcp.Tools.Functions.Commands;
[JsonSerializable(typeof(TemplateListResult))]
[JsonSerializable(typeof(FunctionTemplateResult))]
[JsonSerializable(typeof(TemplateSummary))]
[JsonSerializable(typeof(Dictionary<string, RuntimeVersionInfo>))]
[JsonSerializable(typeof(GitHubTreeResponse))]
[JsonSerializable(typeof(GitHubTreeItem))]
[JsonSerializable(typeof(List<GitHubTreeItem>))]
[JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
internal partial class FunctionsJsonContext : JsonSerializerContext;
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Text.Json.Serialization;

namespace Azure.Mcp.Tools.Functions.Models;

/// <summary>
Expand All @@ -11,30 +9,21 @@ namespace Azure.Mcp.Tools.Functions.Models;
/// </summary>
public sealed class FunctionTemplateResult
{
[JsonPropertyName("language")]
public required string Language { get; init; }

[JsonPropertyName("templateName")]
public required string TemplateName { get; init; }

[JsonPropertyName("displayName")]
public string? DisplayName { get; init; }

[JsonPropertyName("description")]
public string? Description { get; init; }

[JsonPropertyName("bindingType")]
public string? BindingType { get; init; }

[JsonPropertyName("resource")]
public string? Resource { get; init; }

[JsonPropertyName("functionFiles")]
public IReadOnlyList<ProjectTemplateFile> FunctionFiles { get; init; } = [];

[JsonPropertyName("projectFiles")]
public IReadOnlyList<ProjectTemplateFile> ProjectFiles { get; init; } = [];

[JsonPropertyName("mergeInstructions")]
public string MergeInstructions { get; init; } = string.Empty;
}

This file was deleted.

40 changes: 40 additions & 0 deletions tools/Azure.Mcp.Tools.Functions/src/Models/GitHubTreeItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Azure.Mcp.Tools.Functions.Models;

/// <summary>
/// Individual item in GitHub Tree API response.
/// </summary>
public sealed class GitHubTreeItem
{
/// <summary>
/// Gets or sets the path of the item relative to the repository root.
/// </summary>
public string? Path { get; set; }

/// <summary>
/// Gets or sets the file mode (e.g., "100644" for regular file).
/// </summary>
public string? Mode { get; set; }

/// <summary>
/// Gets or sets the type of item: "blob" for files, "tree" for directories.
/// </summary>
public string? Type { get; set; }

/// <summary>
/// Gets or sets the SHA of the item.
/// </summary>
public string? Sha { get; set; }

/// <summary>
/// Gets or sets the size of the file in bytes (only for blobs).
/// </summary>
public long Size { get; set; }

/// <summary>
/// Gets or sets the API URL for this item.
/// </summary>
public string? Url { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Azure.Mcp.Tools.Functions.Models;

/// <summary>
/// GitHub Tree API response model.
/// </summary>
public sealed class GitHubTreeResponse
{
/// <summary>
/// Gets or sets the SHA of the tree.
/// </summary>
public string? Sha { get; set; }

/// <summary>
/// Gets or sets the URL of the tree.
/// </summary>
public string? Url { get; set; }

/// <summary>
/// Gets or sets the list of items in the tree.
/// </summary>
public List<GitHubTreeItem> Tree { get; set; } = [];

/// <summary>
/// Gets or sets whether the tree was truncated due to size.
/// When true, the tree response is incomplete and some files may be missing.
/// </summary>
public bool Truncated { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Text.Json.Serialization;

namespace Azure.Mcp.Tools.Functions.Models;

/// <summary>
Expand All @@ -11,12 +9,9 @@ namespace Azure.Mcp.Tools.Functions.Models;
/// </summary>
public sealed class LanguageDetails
{
[JsonPropertyName("language")]
public required string Language { get; init; }

[JsonPropertyName("info")]
public required LanguageInfo Info { get; init; }

[JsonPropertyName("runtimeVersions")]
public required RuntimeVersionInfo RuntimeVersions { get; init; }
}
17 changes: 0 additions & 17 deletions tools/Azure.Mcp.Tools.Functions/src/Models/LanguageInfo.cs
Original file line number Diff line number Diff line change
@@ -1,76 +1,59 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Text.Json.Serialization;

namespace Azure.Mcp.Tools.Functions.Models;

/// <summary>
/// Represents detailed information about a supported Azure Functions language.
/// </summary>
public sealed class LanguageInfo
{
[JsonPropertyName("name")]
public required string Name { get; init; }

[JsonPropertyName("runtime")]
public required string Runtime { get; init; }

[JsonPropertyName("programmingModel")]
public required string ProgrammingModel { get; init; }

[JsonPropertyName("prerequisites")]
public required IReadOnlyList<string> Prerequisites { get; init; }

[JsonPropertyName("developmentTools")]
public required IReadOnlyList<string> DevelopmentTools { get; init; }

[JsonPropertyName("initCommand")]
public required string InitCommand { get; init; }

[JsonPropertyName("runCommand")]
public required string RunCommand { get; init; }

[JsonPropertyName("buildCommand")]
public string? BuildCommand { get; init; }

/// <summary>
/// Project-level files that initialize a new Azure Functions project for this language.
/// </summary>
[JsonPropertyName("projectFiles")]
public required IReadOnlyList<string> ProjectFiles { get; init; }

/// <summary>
/// Supported runtime versions for this language.
/// </summary>
[JsonPropertyName("runtimeVersions")]
public required RuntimeVersionInfo RuntimeVersions { get; init; }

/// <summary>
/// Step-by-step setup instructions for this language.
/// </summary>
[JsonPropertyName("initInstructions")]
public required string InitInstructions { get; init; }

/// <summary>
/// Description of the project directory structure for this language.
/// </summary>
[JsonPropertyName("projectStructure")]
public required IReadOnlyList<string> ProjectStructure { get; init; }

/// <summary>
/// Template parameters for placeholder replacement (e.g., {{javaVersion}}).
/// Null if this language has no configurable placeholders.
/// </summary>
[JsonPropertyName("templateParameters")]
public IReadOnlyList<TemplateParameter>? TemplateParameters { get; init; }

/// <summary>
/// Notes about why this language is recommended for its runtime.
/// For example, "Recommended for Node.js runtime for type safety and better tooling."
/// Null if not a recommended choice.
/// </summary>
[JsonPropertyName("recommendationNotes")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? RecommendationNotes { get; init; }
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Text.Json.Serialization;

namespace Azure.Mcp.Tools.Functions.Models;

/// <summary>
Expand All @@ -11,12 +9,9 @@ namespace Azure.Mcp.Tools.Functions.Models;
/// </summary>
public sealed class LanguageListResult
{
[JsonPropertyName("functionsRuntimeVersion")]
public required string FunctionsRuntimeVersion { get; init; }

[JsonPropertyName("extensionBundleVersion")]
public required string ExtensionBundleVersion { get; init; }

[JsonPropertyName("languages")]
public required IReadOnlyList<LanguageDetails> Languages { get; init; }
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Text.Json.Serialization;

namespace Azure.Mcp.Tools.Functions.Models;

/// <summary>
Expand All @@ -11,9 +9,7 @@ namespace Azure.Mcp.Tools.Functions.Models;
/// </summary>
public sealed class ProjectTemplateFile
{
[JsonPropertyName("fileName")]
public required string FileName { get; init; }

[JsonPropertyName("content")]
public required string Content { get; init; }
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Text.Json.Serialization;

namespace Azure.Mcp.Tools.Functions.Models;

/// <summary>
Expand All @@ -11,12 +9,9 @@ namespace Azure.Mcp.Tools.Functions.Models;
/// </summary>
public sealed class ProjectTemplateResult
{
[JsonPropertyName("language")]
public required string Language { get; init; }

[JsonPropertyName("initInstructions")]
public required string InitInstructions { get; init; }

[JsonPropertyName("projectStructure")]
public required IReadOnlyList<string> ProjectStructure { get; init; }
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Text.Json.Serialization;

namespace Azure.Mcp.Tools.Functions.Models;

/// <summary>
Expand All @@ -11,18 +9,13 @@ namespace Azure.Mcp.Tools.Functions.Models;
/// </summary>
public sealed class RuntimeVersionInfo
{
[JsonPropertyName("supported")]
public required IReadOnlyList<string> Supported { get; init; }

[JsonPropertyName("preview")]
public IReadOnlyList<string>? Preview { get; init; }

[JsonPropertyName("deprecated")]
public IReadOnlyList<string>? Deprecated { get; init; }

[JsonPropertyName("default")]
public required string Default { get; init; }

[JsonPropertyName("frameworkSupported")]
public IReadOnlyList<string>? FrameworkSupported { get; init; }
}
Loading