Skip to content
Clone
304994f
1470 lines 54.4 KB Rust
pub(crate) mod args;
pub(crate) mod helpers;
pub(crate) mod issue;
pub(crate) mod me;
pub(crate) mod pull;
pub(crate) mod repo;
pub(crate) mod space;
use rmcp::ErrorData;
use rmcp::handler::server::wrapper::Parameters;
use rmcp::model::CallToolResult;
use rmcp::service::RequestContext;
use rmcp::{RoleServer, tool, tool_router};
use crate::McpServer;
#[tool_router(vis = "pub(crate)")]
impl McpServer {
#[tool(
description = "返回当前访问密钥对应的用户身份、密钥读写范围(scope);使用临时空间密钥时同时返回该临时密钥及其有效期。",
annotations(read_only_hint = true)
)]
async fn me_get(&self, ctx: RequestContext<RoleServer>) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(me::get(&self.services, &principal).await)
}
#[tool(
description = "查询当前访问密钥的用户在指定 space 中的全部有效权限(view_space/read/message/manage_*)。",
annotations(read_only_hint = true)
)]
async fn me_space_permissions(
&self,
Parameters(args): Parameters<args::SpaceNameArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(me::space_permissions(&self.services, &principal, args).await)
}
#[tool(
description = "查询当前访问密钥的用户在指定仓库上的 read/write/admin 权限。",
annotations(read_only_hint = true)
)]
async fn me_repo_permissions(
&self,
Parameters(args): Parameters<args::RepoRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(me::repo_permissions(&self.services, &principal, args).await)
}
#[tool(
description = "返回当前访问密钥的用户拥有的 space 列表。",
annotations(read_only_hint = true)
)]
async fn me_spaces(
&self,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(me::my_spaces(&self.services, &principal).await)
}
#[tool(
description = "按用户名或 UID 查询平台用户的公开资料。",
annotations(read_only_hint = true)
)]
async fn user_get(
&self,
Parameters(args): Parameters<args::UserRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(me::user_get(&self.services, &principal, args).await)
}
#[tool(
description = "按一组 UID 批量查询平台用户公开资料(最多 100 个)。",
annotations(read_only_hint = true)
)]
async fn users_get(
&self,
Parameters(args): Parameters<args::UserIdsArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(me::users_get(&self.services, &principal, args).await)
}
#[tool(
description = "列出当前用户拥有的 space。",
annotations(read_only_hint = true)
)]
async fn space_list(
&self,
Parameters(args): Parameters<args::SpaceListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::list(&self.services, &principal, args).await)
}
#[tool(
description = "浏览公开 space(未私有的可加入空间)。",
annotations(read_only_hint = true)
)]
async fn space_explore(
&self,
Parameters(args): Parameters<args::SpaceExploreArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::explore(&self.services, &principal, args).await)
}
#[tool(
description = "按名称获取 space 详情(私有时需要成员权限)。",
annotations(read_only_hint = true)
)]
async fn space_get(
&self,
Parameters(args): Parameters<args::SpaceNameArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::get(&self.services, &principal, args).await)
}
#[tool(description = "创建 space(当前用户成为所有者)。")]
async fn space_create(
&self,
Parameters(args): Parameters<args::SpaceCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::create(&self.services, &principal, args).await)
}
#[tool(description = "更新 space 设置(仅所有者)。")]
async fn space_update(
&self,
Parameters(args): Parameters<args::SpaceUpdateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::update(&self.services, &principal, args).await)
}
#[tool(
description = "停用(软删除)space(仅所有者)。",
annotations(destructive_hint = true)
)]
async fn space_delete(
&self,
Parameters(args): Parameters<args::SpaceNameArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::delete(&self.services, &principal, args).await)
}
#[tool(description = "列出 space 成员。", annotations(read_only_hint = true))]
async fn space_member_list(
&self,
Parameters(args): Parameters<args::SpaceMemberListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::member_list(&self.services, &principal, args).await)
}
#[tool(description = "添加 space 成员(需要 manage_members 权限)。")]
async fn space_member_add(
&self,
Parameters(args): Parameters<args::SpaceMemberAddArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::member_add(&self.services, &principal, args).await)
}
#[tool(description = "更新 space 成员属性(需要 manage_members 权限)。")]
async fn space_member_update(
&self,
Parameters(args): Parameters<args::SpaceMemberUpdateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::member_update(&self.services, &principal, args).await)
}
#[tool(
description = "移除 space 成员(需要 manage_members 权限)。",
annotations(destructive_hint = true)
)]
async fn space_member_remove(
&self,
Parameters(args): Parameters<args::SpaceMemberRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::member_remove(&self.services, &principal, args).await)
}
#[tool(description = "主动退出 space(所有者不可退出)。")]
async fn space_member_leave(
&self,
Parameters(args): Parameters<args::SpaceNameArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::member_leave(&self.services, &principal, args).await)
}
#[tool(
description = "列出 space 的角色组(需要 manage_roles 权限)。",
annotations(read_only_hint = true)
)]
async fn space_group_list(
&self,
Parameters(args): Parameters<args::SpaceGroupListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::group_list(&self.services, &principal, args).await)
}
#[tool(description = "创建 space 角色组(需要 manage_roles 权限)。")]
async fn space_group_create(
&self,
Parameters(args): Parameters<args::SpaceGroupCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::group_create(&self.services, &principal, args).await)
}
#[tool(description = "更新 space 角色组(需要 manage_roles 权限)。")]
async fn space_group_update(
&self,
Parameters(args): Parameters<args::SpaceGroupUpdateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::group_update(&self.services, &principal, args).await)
}
#[tool(
description = "删除 space 角色组(需要 manage_roles 权限)。",
annotations(destructive_hint = true)
)]
async fn space_group_delete(
&self,
Parameters(args): Parameters<args::SpaceGroupRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::group_delete(&self.services, &principal, args).await)
}
#[tool(description = "把成员加入角色组(需要 manage_roles 权限)。")]
async fn space_group_assign(
&self,
Parameters(args): Parameters<args::SpaceGroupAssignArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::group_assign(&self.services, &principal, args).await)
}
#[tool(description = "把成员移出角色组(需要 manage_roles 权限)。")]
async fn space_group_unassign(
&self,
Parameters(args): Parameters<args::SpaceGroupAssignArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::group_unassign(&self.services, &principal, args).await)
}
#[tool(
description = "获取 space 的目录树(可见性受目录覆盖规则限制)。",
annotations(read_only_hint = true)
)]
async fn space_dir_tree(
&self,
Parameters(args): Parameters<args::SpaceDirTreeArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::dir_tree(&self.services, &principal, args).await)
}
#[tool(description = "创建目录节点(需要 manage_channels 权限)。")]
async fn space_dir_create(
&self,
Parameters(args): Parameters<args::SpaceDirCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::dir_create(&self.services, &principal, args).await)
}
#[tool(description = "重命名目录节点(需要 manage_channels 权限)。")]
async fn space_dir_update(
&self,
Parameters(args): Parameters<args::SpaceDirUpdateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::dir_update(&self.services, &principal, args).await)
}
#[tool(description = "移动目录节点(需要 manage_channels 权限)。")]
async fn space_dir_move(
&self,
Parameters(args): Parameters<args::SpaceDirMoveArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::dir_move(&self.services, &principal, args).await)
}
#[tool(
description = "列出 space 邀请(需要 manage_invites 权限)。",
annotations(read_only_hint = true)
)]
async fn space_invite_list(
&self,
Parameters(args): Parameters<args::SpaceInviteListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::invite_list(&self.services, &principal, args).await)
}
#[tool(description = "创建 space 邀请(需要 manage_invites 权限)。")]
async fn space_invite_create(
&self,
Parameters(args): Parameters<args::SpaceInviteCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::invite_create(&self.services, &principal, args).await)
}
#[tool(
description = "撤销 space 邀请(需要 manage_invites 权限)。",
annotations(destructive_hint = true)
)]
async fn space_invite_revoke(
&self,
Parameters(args): Parameters<args::SpaceInviteRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::invite_revoke(&self.services, &principal, args).await)
}
#[tool(
description = "列出 space 加入申请(需要 manage_members 权限)。",
annotations(read_only_hint = true)
)]
async fn space_join_request_list(
&self,
Parameters(args): Parameters<args::SpaceJoinRequestListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::join_request_list(&self.services, &principal, args).await)
}
#[tool(description = "提交加入 space 的申请。")]
async fn space_join_request_create(
&self,
Parameters(args): Parameters<args::SpaceJoinRequestCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::join_request_create(&self.services, &principal, args).await)
}
#[tool(description = "撤回自己的加入申请。")]
async fn space_join_request_withdraw(
&self,
Parameters(args): Parameters<args::SpaceJoinRequestRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::join_request_withdraw(&self.services, &principal, args).await)
}
#[tool(description = "通过加入申请(需要 manage_members 权限)。")]
async fn space_join_request_approve(
&self,
Parameters(args): Parameters<args::SpaceJoinRequestRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::join_request_approve(&self.services, &principal, args).await)
}
#[tool(description = "拒绝加入申请(需要 manage_members 权限)。")]
async fn space_join_request_reject(
&self,
Parameters(args): Parameters<args::SpaceJoinRequestRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(space::join_request_reject(&self.services, &principal, args).await)
}
#[tool(
description = "列出 space 下的仓库(私有仓库仅协作者可见)。",
annotations(read_only_hint = true)
)]
async fn repo_list(
&self,
Parameters(args): Parameters<args::RepoListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::list(&self.services, &principal, args).await)
}
#[tool(
description = "获取仓库详情(需要读权限)。",
annotations(read_only_hint = true)
)]
async fn repo_get(
&self,
Parameters(args): Parameters<args::RepoRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::get(&self.services, &principal, args).await)
}
#[tool(description = "在 space 下创建仓库(需要 space 所有者权限)。")]
async fn repo_create(
&self,
Parameters(args): Parameters<args::RepoCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::create(&self.services, &principal, args).await)
}
#[tool(description = "更新仓库设置(需要 space 所有者权限)。")]
async fn repo_update(
&self,
Parameters(args): Parameters<args::RepoUpdateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::update(&self.services, &principal, args).await)
}
#[tool(description = "归档或取消归档仓库(需要 space 所有者权限)。")]
async fn repo_set_archived(
&self,
Parameters(args): Parameters<args::RepoArchiveArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::set_archived(&self.services, &principal, args).await)
}
#[tool(description = "列出仓库分支。", annotations(read_only_hint = true))]
async fn repo_branch_list(
&self,
Parameters(args): Parameters<args::RepoRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::branch_list(&self.services, &principal, args).await)
}
#[tool(description = "获取单个分支信息。", annotations(read_only_hint = true))]
async fn repo_branch_get(
&self,
Parameters(args): Parameters<args::RepoBranchGetArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::branch_get(&self.services, &principal, args).await)
}
#[tool(description = "创建分支(需要仓库写权限)。")]
async fn repo_branch_create(
&self,
Parameters(args): Parameters<args::RepoBranchCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::branch_create(&self.services, &principal, args).await)
}
#[tool(description = "重命名分支(需要仓库写权限)。")]
async fn repo_branch_rename(
&self,
Parameters(args): Parameters<args::RepoBranchRenameArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::branch_rename(&self.services, &principal, args).await)
}
#[tool(
description = "删除分支(需要仓库写权限)。",
annotations(destructive_hint = true)
)]
async fn repo_branch_delete(
&self,
Parameters(args): Parameters<args::RepoBranchDeleteArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::branch_delete(&self.services, &principal, args).await)
}
#[tool(description = "设置默认分支(需要仓库写权限)。")]
async fn repo_branch_set_default(
&self,
Parameters(args): Parameters<args::RepoBranchDefaultArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::branch_set_default(&self.services, &principal, args).await)
}
#[tool(description = "列出仓库标签。", annotations(read_only_hint = true))]
async fn repo_tag_list(
&self,
Parameters(args): Parameters<args::RepoRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::tag_list(&self.services, &principal, args).await)
}
#[tool(description = "获取单个标签。", annotations(read_only_hint = true))]
async fn repo_tag_get(
&self,
Parameters(args): Parameters<args::RepoTagGetArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::tag_get(&self.services, &principal, args).await)
}
#[tool(description = "创建标签(需要仓库写权限)。")]
async fn repo_tag_create(
&self,
Parameters(args): Parameters<args::RepoTagCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::tag_create(&self.services, &principal, args).await)
}
#[tool(
description = "删除标签(需要仓库写权限)。",
annotations(destructive_hint = true)
)]
async fn repo_tag_delete(
&self,
Parameters(args): Parameters<args::RepoTagDeleteArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::tag_delete(&self.services, &principal, args).await)
}
#[tool(
description = "列出提交历史(可按路径/数量过滤)。",
annotations(read_only_hint = true)
)]
async fn repo_commit_list(
&self,
Parameters(args): Parameters<args::RepoCommitListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::commit_list(&self.services, &principal, args).await)
}
#[tool(description = "获取单个提交详情。", annotations(read_only_hint = true))]
async fn repo_commit_get(
&self,
Parameters(args): Parameters<args::RepoCommitGetArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::commit_get(&self.services, &principal, args).await)
}
#[tool(
description = "浏览仓库目录树(recurse=true 递归列出全部条目)。",
annotations(read_only_hint = true)
)]
async fn repo_tree(
&self,
Parameters(args): Parameters<args::RepoTreeArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::tree(&self.services, &principal, args).await)
}
#[tool(
description = "按路径读取仓库文件内容(文本返回 utf-8,二进制返回 base64)。",
annotations(read_only_hint = true)
)]
async fn repo_file_get(
&self,
Parameters(args): Parameters<args::RepoFileArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::file_get(&self.services, &principal, args).await)
}
#[tool(description = "列出仓库 Release。", annotations(read_only_hint = true))]
async fn repo_release_list(
&self,
Parameters(args): Parameters<args::RepoReleaseListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::release_list(&self.services, &principal, args).await)
}
#[tool(
description = "按 tag 获取 Release。",
annotations(read_only_hint = true)
)]
async fn repo_release_get(
&self,
Parameters(args): Parameters<args::RepoReleaseGetArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::release_get(&self.services, &principal, args).await)
}
#[tool(description = "创建 Release(需要仓库写权限)。")]
async fn repo_release_create(
&self,
Parameters(args): Parameters<args::RepoReleaseCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::release_create(&self.services, &principal, args).await)
}
#[tool(description = "更新 Release(发布者或仓库管理员)。")]
async fn repo_release_update(
&self,
Parameters(args): Parameters<args::RepoReleaseUpdateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::release_update(&self.services, &principal, args).await)
}
#[tool(
description = "删除 Release(发布者或仓库管理员)。",
annotations(destructive_hint = true)
)]
async fn repo_release_delete(
&self,
Parameters(args): Parameters<args::RepoReleaseDeleteArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::release_delete(&self.services, &principal, args).await)
}
#[tool(description = "列出仓库 topics。", annotations(read_only_hint = true))]
async fn repo_topic_list(
&self,
Parameters(args): Parameters<args::RepoTopicArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::topic_list(&self.services, &principal, args).await)
}
#[tool(description = "为仓库添加 topic(需要仓库写权限)。")]
async fn repo_topic_add(
&self,
Parameters(args): Parameters<args::RepoTopicChangeArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::topic_add(&self.services, &principal, args).await)
}
#[tool(description = "移除仓库 topic(需要仓库写权限)。")]
async fn repo_topic_remove(
&self,
Parameters(args): Parameters<args::RepoTopicChangeArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::topic_remove(&self.services, &principal, args).await)
}
#[tool(description = "收藏仓库。")]
async fn repo_star(
&self,
Parameters(args): Parameters<args::RepoRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::star(&self.services, &principal, args).await)
}
#[tool(description = "取消收藏仓库。")]
async fn repo_unstar(
&self,
Parameters(args): Parameters<args::RepoRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::unstar(&self.services, &principal, args).await)
}
#[tool(description = "设置仓库关注模式(unwatched/watching/ignore)。")]
async fn repo_watch(
&self,
Parameters(args): Parameters<args::RepoWatchArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::watch(&self.services, &principal, args).await)
}
#[tool(description = "列出仓库收藏者。", annotations(read_only_hint = true))]
async fn repo_stargazers(
&self,
Parameters(args): Parameters<args::RepoStargazerListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::stargazers(&self.services, &principal, args).await)
}
#[tool(description = "列出仓库关注者。", annotations(read_only_hint = true))]
async fn repo_watchers(
&self,
Parameters(args): Parameters<args::RepoWatcherListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(repo::watchers(&self.services, &principal, args).await)
}
#[tool(
description = "列出 space 内的 issue 看板。",
annotations(read_only_hint = true)
)]
async fn issue_board_list(
&self,
Parameters(args): Parameters<args::IssueBoardListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::board_list(&self.services, &principal, args).await)
}
#[tool(
description = "获取 issue 看板详情。",
annotations(read_only_hint = true)
)]
async fn issue_board_get(
&self,
Parameters(args): Parameters<args::IssueBoardRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::board_get(&self.services, &principal, args).await)
}
#[tool(description = "创建 issue 看板(需要 manage_channels 权限)。")]
async fn issue_board_create(
&self,
Parameters(args): Parameters<args::IssueBoardCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::board_create(&self.services, &principal, args).await)
}
#[tool(description = "更新 issue 看板(需要管理权限)。")]
async fn issue_board_update(
&self,
Parameters(args): Parameters<args::IssueBoardUpdateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::board_update(&self.services, &principal, args).await)
}
#[tool(
description = "删除 issue 看板(需要管理权限)。",
annotations(destructive_hint = true)
)]
async fn issue_board_delete(
&self,
Parameters(args): Parameters<args::IssueBoardRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::board_delete(&self.services, &principal, args).await)
}
#[tool(
description = "分页/过滤查询 issue。",
annotations(read_only_hint = true)
)]
async fn issue_list(
&self,
Parameters(args): Parameters<args::IssueListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::list(&self.services, &principal, args).await)
}
#[tool(
description = "获取 issue 详情(issue_id 支持 UUID 或看板内编号)。",
annotations(read_only_hint = true)
)]
async fn issue_get(
&self,
Parameters(args): Parameters<args::IssueRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::get(&self.services, &principal, args).await)
}
#[tool(description = "创建 issue。")]
async fn issue_create(
&self,
Parameters(args): Parameters<args::IssueCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::create(&self.services, &principal, args).await)
}
#[tool(description = "更新 issue(作者或看板管理员)。")]
async fn issue_update(
&self,
Parameters(args): Parameters<args::IssueUpdateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::update(&self.services, &principal, args).await)
}
#[tool(
description = "删除 issue(作者或看板管理员)。",
annotations(destructive_hint = true)
)]
async fn issue_delete(
&self,
Parameters(args): Parameters<args::IssueRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::delete(&self.services, &principal, args).await)
}
#[tool(description = "关闭 issue。")]
async fn issue_close(
&self,
Parameters(args): Parameters<args::IssueRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::set_closed(&self.services, &principal, args, true).await)
}
#[tool(description = "重新打开 issue。")]
async fn issue_reopen(
&self,
Parameters(args): Parameters<args::IssueRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::set_closed(&self.services, &principal, args, false).await)
}
#[tool(description = "列出 issue 评论。", annotations(read_only_hint = true))]
async fn issue_comment_list(
&self,
Parameters(args): Parameters<args::IssueCommentListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::comment_list(&self.services, &principal, args).await)
}
#[tool(description = "发表 issue 评论。")]
async fn issue_comment_create(
&self,
Parameters(args): Parameters<args::IssueCommentCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::comment_create(&self.services, &principal, args).await)
}
#[tool(description = "更新 issue 评论(作者或看板管理员)。")]
async fn issue_comment_update(
&self,
Parameters(args): Parameters<args::IssueCommentUpdateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::comment_update(&self.services, &principal, args).await)
}
#[tool(
description = "删除 issue 评论(作者或看板管理员)。",
annotations(destructive_hint = true)
)]
async fn issue_comment_delete(
&self,
Parameters(args): Parameters<args::IssueCommentRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::comment_delete(&self.services, &principal, args).await)
}
#[tool(description = "列出看板标签。", annotations(read_only_hint = true))]
async fn issue_label_list(
&self,
Parameters(args): Parameters<args::IssueLabelListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::label_list(&self.services, &principal, args).await)
}
#[tool(description = "创建看板标签(需要看板管理权限)。")]
async fn issue_label_create(
&self,
Parameters(args): Parameters<args::IssueLabelCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::label_create(&self.services, &principal, args).await)
}
#[tool(description = "更新看板标签(需要看板管理权限)。")]
async fn issue_label_update(
&self,
Parameters(args): Parameters<args::IssueLabelUpdateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::label_update(&self.services, &principal, args).await)
}
#[tool(
description = "删除看板标签(需要看板管理权限)。",
annotations(destructive_hint = true)
)]
async fn issue_label_delete(
&self,
Parameters(args): Parameters<args::IssueLabelRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::label_delete(&self.services, &principal, args).await)
}
#[tool(description = "给 issue 绑定标签。")]
async fn issue_label_bind(
&self,
Parameters(args): Parameters<args::IssueLabelBindArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::label_bind(&self.services, &principal, args).await)
}
#[tool(description = "解绑 issue 标签。")]
async fn issue_label_unbind(
&self,
Parameters(args): Parameters<args::IssueLabelBindArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::label_unbind(&self.services, &principal, args).await)
}
#[tool(description = "列出看板里程碑。", annotations(read_only_hint = true))]
async fn issue_milestone_list(
&self,
Parameters(args): Parameters<args::IssueMilestoneListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::milestone_list(&self.services, &principal, args).await)
}
#[tool(description = "创建看板里程碑(需要看板管理权限)。")]
async fn issue_milestone_create(
&self,
Parameters(args): Parameters<args::IssueMilestoneCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::milestone_create(&self.services, &principal, args).await)
}
#[tool(description = "更新看板里程碑(需要看板管理权限)。")]
async fn issue_milestone_update(
&self,
Parameters(args): Parameters<args::IssueMilestoneUpdateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::milestone_update(&self.services, &principal, args).await)
}
#[tool(
description = "删除看板里程碑(需要看板管理权限)。",
annotations(destructive_hint = true)
)]
async fn issue_milestone_delete(
&self,
Parameters(args): Parameters<args::IssueMilestoneRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::milestone_delete(&self.services, &principal, args).await)
}
#[tool(
description = "列出 issue 成员(参与者/关注者等)。",
annotations(read_only_hint = true)
)]
async fn issue_member_list(
&self,
Parameters(args): Parameters<args::IssueMemberListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::member_list(&self.services, &principal, args).await)
}
#[tool(description = "添加 issue 成员(需要看板管理权限)。")]
async fn issue_member_create(
&self,
Parameters(args): Parameters<args::IssueMemberCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::member_create(&self.services, &principal, args).await)
}
#[tool(
description = "移除 issue 成员(需要看板管理权限)。",
annotations(destructive_hint = true)
)]
async fn issue_member_delete(
&self,
Parameters(args): Parameters<args::IssueMemberRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::member_delete(&self.services, &principal, args).await)
}
#[tool(description = "列出看板置顶。", annotations(read_only_hint = true))]
async fn issue_pin_list(
&self,
Parameters(args): Parameters<args::IssuePinListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::pin_list(&self.services, &principal, args).await)
}
#[tool(description = "置顶 issue(需要看板管理权限)。")]
async fn issue_pin_create(
&self,
Parameters(args): Parameters<args::IssuePinCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::pin_create(&self.services, &principal, args).await)
}
#[tool(description = "调整置顶顺序(需要看板管理权限)。")]
async fn issue_pin_update(
&self,
Parameters(args): Parameters<args::IssuePinUpdateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::pin_update(&self.services, &principal, args).await)
}
#[tool(
description = "取消置顶(需要看板管理权限)。",
annotations(destructive_hint = true)
)]
async fn issue_pin_delete(
&self,
Parameters(args): Parameters<args::IssuePinRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::pin_delete(&self.services, &principal, args).await)
}
#[tool(description = "列出 issue 依赖。", annotations(read_only_hint = true))]
async fn issue_dependency_list(
&self,
Parameters(args): Parameters<args::IssueDependencyListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::dependency_list(&self.services, &principal, args).await)
}
#[tool(description = "添加 issue 依赖(需要看板管理权限)。")]
async fn issue_dependency_create(
&self,
Parameters(args): Parameters<args::IssueDependencyCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::dependency_create(&self.services, &principal, args).await)
}
#[tool(
description = "删除 issue 依赖(需要看板管理权限)。",
annotations(destructive_hint = true)
)]
async fn issue_dependency_delete(
&self,
Parameters(args): Parameters<args::IssueDependencyRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(issue::dependency_delete(&self.services, &principal, args).await)
}
#[tool(
description = "列出仓库的合并请求。",
annotations(read_only_hint = true)
)]
async fn pull_list(
&self,
Parameters(args): Parameters<args::PullListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::list(&self.services, &principal, args).await)
}
#[tool(
description = "获取合并请求详情(pull 支持编号或 UUID)。",
annotations(read_only_hint = true)
)]
async fn pull_get(
&self,
Parameters(args): Parameters<args::PullRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::get(&self.services, &principal, args).await)
}
#[tool(description = "创建合并请求(需要仓库写权限)。")]
async fn pull_create(
&self,
Parameters(args): Parameters<args::PullCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::create(&self.services, &principal, args).await)
}
#[tool(description = "更新合并请求(需要仓库写权限)。")]
async fn pull_update(
&self,
Parameters(args): Parameters<args::PullUpdateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::update(&self.services, &principal, args).await)
}
#[tool(description = "关闭合并请求(作者或仓库管理员)。")]
async fn pull_close(
&self,
Parameters(args): Parameters<args::PullRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::set_state(&self.services, &principal, args, true).await)
}
#[tool(description = "重新打开合并请求(作者或仓库管理员)。")]
async fn pull_reopen(
&self,
Parameters(args): Parameters<args::PullRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::set_state(&self.services, &principal, args, false).await)
}
#[tool(
description = "删除合并请求(仅仓库管理员)。",
annotations(destructive_hint = true)
)]
async fn pull_delete(
&self,
Parameters(args): Parameters<args::PullRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::delete(&self.services, &principal, args).await)
}
#[tool(
description = "合并合并请求(受分支保护与审批门槛限制)。",
annotations(destructive_hint = true)
)]
async fn pull_merge(
&self,
Parameters(args): Parameters<args::PullMergeArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::merge(&self.services, &principal, args).await)
}
#[tool(description = "列出合并请求评论。", annotations(read_only_hint = true))]
async fn pull_comment_list(
&self,
Parameters(args): Parameters<args::PullCommentListArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::comment_list(&self.services, &principal, args).await)
}
#[tool(description = "发表合并请求评论。")]
async fn pull_comment_create(
&self,
Parameters(args): Parameters<args::PullCommentCreateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::comment_create(&self.services, &principal, args).await)
}
#[tool(description = "更新合并请求评论(作者或管理员)。")]
async fn pull_comment_update(
&self,
Parameters(args): Parameters<args::PullCommentUpdateArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::comment_update(&self.services, &principal, args).await)
}
#[tool(
description = "删除合并请求评论(作者或管理员)。",
annotations(destructive_hint = true)
)]
async fn pull_comment_delete(
&self,
Parameters(args): Parameters<args::PullCommentRefArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::comment_delete(&self.services, &principal, args).await)
}
#[tool(description = "标记/取消标记评论已解决。")]
async fn pull_comment_resolve(
&self,
Parameters(args): Parameters<args::PullCommentResolveArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::comment_resolve(&self.services, &principal, args).await)
}
#[tool(
description = "列出合并请求的评审。",
annotations(read_only_hint = true)
)]
async fn pull_review_list(
&self,
Parameters(args): Parameters<args::PullReviewsArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::review_list(&self.services, &principal, args).await)
}
#[tool(description = "提交评审(approve/request_changes/comment)。")]
async fn pull_review_submit(
&self,
Parameters(args): Parameters<args::PullReviewSubmitArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::review_submit(&self.services, &principal, args).await)
}
#[tool(description = "驳回评审(需要管理员)。")]
async fn pull_review_dismiss(
&self,
Parameters(args): Parameters<args::PullReviewDismissArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::review_dismiss(&self.services, &principal, args).await)
}
#[tool(description = "列出评审请求。", annotations(read_only_hint = true))]
async fn pull_reviewer_list(
&self,
Parameters(args): Parameters<args::PullReviewsArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::reviewer_list(&self.services, &principal, args).await)
}
#[tool(description = "请求评审人(需要仓库写权限)。")]
async fn pull_reviewer_request(
&self,
Parameters(args): Parameters<args::PullReviewerRequestArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::reviewer_request(&self.services, &principal, args).await)
}
#[tool(description = "取消评审请求(需要仓库写权限)。")]
async fn pull_reviewer_cancel(
&self,
Parameters(args): Parameters<args::PullReviewerCancelArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::reviewer_cancel(&self.services, &principal, args).await)
}
#[tool(
description = "列出合并请求指派人。",
annotations(read_only_hint = true)
)]
async fn pull_assignee_list(
&self,
Parameters(args): Parameters<args::PullReviewsArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::assignee_list(&self.services, &principal, args).await)
}
#[tool(description = "指派合并请求负责人(需要仓库写权限)。")]
async fn pull_assignee_add(
&self,
Parameters(args): Parameters<args::PullAssigneeArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::assignee_add(&self.services, &principal, args).await)
}
#[tool(description = "移除合并请求负责人(需要仓库写权限)。")]
async fn pull_assignee_remove(
&self,
Parameters(args): Parameters<args::PullAssigneeArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::assignee_remove(&self.services, &principal, args).await)
}
#[tool(description = "列出合并请求标签。", annotations(read_only_hint = true))]
async fn pull_label_list(
&self,
Parameters(args): Parameters<args::PullReviewsArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::label_list(&self.services, &principal, args).await)
}
#[tool(description = "给合并请求添加标签(需要仓库写权限)。")]
async fn pull_label_attach(
&self,
Parameters(args): Parameters<args::PullLabelArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::label_attach(&self.services, &principal, args).await)
}
#[tool(description = "移除合并请求标签(需要仓库写权限)。")]
async fn pull_label_detach(
&self,
Parameters(args): Parameters<args::PullLabelArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::label_detach(&self.services, &principal, args).await)
}
#[tool(
description = "查看合并请求的 CI 检查状态。",
annotations(read_only_hint = true)
)]
async fn pull_checks(
&self,
Parameters(args): Parameters<args::PullReviewsArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::checks(&self.services, &principal, args).await)
}
#[tool(
description = "查看合并请求的合并门槛(分支保护/审批)。",
annotations(read_only_hint = true)
)]
async fn pull_gate(
&self,
Parameters(args): Parameters<args::PullReviewsArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::gate(&self.services, &principal, args).await)
}
#[tool(
description = "查看我的合并请求收件箱(created/review-requested/reviewed,scope 用 kebab-case)。",
annotations(read_only_hint = true)
)]
async fn pull_inbox(
&self,
Parameters(args): Parameters<args::PullInboxArgs>,
ctx: RequestContext<RoleServer>,
) -> Result<CallToolResult, ErrorData> {
let principal = self.principal(&ctx)?;
Ok(pull::inbox(&self.services, &principal, args).await)
}
}