using GiteaMcp.Config;
using GiteaMcp.Services;
using GiteaMcp.Services.Models;
using Microsoft.Extensions.Options;
using ModelContextProtocol.Server;
using System.ComponentModel;
namespace GiteaMcp.Tools;
/// 文件树与文件内容 Tool:list_tree / read_file
[McpServerToolType]
public class TreeTools(
GiteaApiClient gitea,
GiteaRepoFilter filter,
IOptions opts)
{
private readonly GiteaOptions _opts = opts.Value;
[McpServerTool]
[Description(
"List the file tree of a Gitea repository at a given ref (branch/tag/SHA). " +
"When recursive=false (default), returns only top-level entries. " +
"When recursive=true, returns all files up to max_entries=500 — use this to map repo structure. " +
"Returns: path, type ('blob'=file, 'tree'=directory), size (bytes), sha. " +
"For very large repos (>500 files), truncated=true will be set; narrow down by adjusting paths manually.")]
public async Task