Skip to main content

github_mcp/prompts/
router.rs

1//! One method per MCP prompt. See docs/mcp-prompts-workflow-plan.md for the
2//! design rationale (agnostic phrasing, whole-sub-workflow delegation,
3//! content-size targets) that every `content/*.md` file must follow.
4
5use rmcp::handler::server::wrapper::Parameters;
6use rmcp::model::{PromptMessage, Role};
7use rmcp::{prompt, prompt_router};
8
9use crate::core::mcp_server::McpifyServer;
10use crate::prompts::{MasterWorkflowArgs, PullRequestWorkflowArgs, render_context_header};
11
12#[prompt_router(vis = "pub(crate)")]
13impl McpifyServer {
14    #[prompt(
15        name = "github_workflow",
16        description = "Start here. Presents the available GitHub management workflows, \
17                        routes to the right guided sub-workflow based on the user's goal, \
18                        and -- where the environment supports it -- delegates that whole \
19                        sub-workflow to an isolated sub-task to spare this conversation's \
20                        context window."
21    )]
22    async fn github_workflow_prompt(
23        &self,
24        Parameters(args): Parameters<MasterWorkflowArgs>,
25    ) -> Vec<PromptMessage> {
26        let header = render_context_header(&[("goal", args.goal.as_deref())]);
27        vec![PromptMessage::new_text(
28            Role::User,
29            format!("{header}\n\n{}", include_str!("content/master.md")),
30        )]
31    }
32
33    #[prompt(
34        name = "github_workflow_pull_request",
35        description = "Guided, multi-step pull request flow: the fork-vs-direct-branch \
36                        decision, branch/commit/push, opening the PR, reviewers, and \
37                        verifying checks/reviews before declaring it ready to merge."
38    )]
39    async fn github_workflow_pull_request_prompt(
40        &self,
41        Parameters(args): Parameters<PullRequestWorkflowArgs>,
42    ) -> Vec<PromptMessage> {
43        let header = render_context_header(&[
44            ("owner", args.owner.as_deref()),
45            ("repo", args.repo.as_deref()),
46            ("base_branch", args.base_branch.as_deref()),
47            ("head_branch", args.head_branch.as_deref()),
48        ]);
49        vec![PromptMessage::new_text(
50            Role::User,
51            format!("{header}\n\n{}", include_str!("content/pull_request.md")),
52        )]
53    }
54
55    #[prompt(
56        name = "github_workflow_repos",
57        description = "Repository lifecycle (create, fork, transfer, archive, delete), \
58                        branches and branch protection, tags, commits/git data, releases, \
59                        topics/settings, webhooks."
60    )]
61    async fn github_workflow_repos_prompt(&self) -> Vec<PromptMessage> {
62        vec![PromptMessage::new_text(
63            Role::User,
64            include_str!("content/repos.md"),
65        )]
66    }
67
68    #[prompt(
69        name = "github_workflow_issues",
70        description = "Issue lifecycle, labels, milestones, assignees, comments, reactions."
71    )]
72    async fn github_workflow_issues_prompt(&self) -> Vec<PromptMessage> {
73        vec![PromptMessage::new_text(
74            Role::User,
75            include_str!("content/issues.md"),
76        )]
77    }
78
79    #[prompt(
80        name = "github_workflow_actions_ci",
81        description = "GitHub Actions workflows, runs, artifacts, secrets/variables, \
82                        self-hosted runners, hosted compute, check-runs."
83    )]
84    async fn github_workflow_actions_ci_prompt(&self) -> Vec<PromptMessage> {
85        vec![PromptMessage::new_text(
86            Role::User,
87            include_str!("content/actions_ci.md"),
88        )]
89    }
90
91    #[prompt(
92        name = "github_workflow_orgs_teams",
93        description = "Organizations, teams, enterprise teams/memberships, members, outside \
94                        collaborators."
95    )]
96    async fn github_workflow_orgs_teams_prompt(&self) -> Vec<PromptMessage> {
97        vec![PromptMessage::new_text(
98            Role::User,
99            include_str!("content/orgs_teams.md"),
100        )]
101    }
102
103    #[prompt(
104        name = "github_workflow_security_suite",
105        description = "Code scanning, secret scanning, code security configurations, \
106                        Dependabot, security advisories, dependency graph, private \
107                        registries."
108    )]
109    async fn github_workflow_security_suite_prompt(&self) -> Vec<PromptMessage> {
110        vec![PromptMessage::new_text(
111            Role::User,
112            include_str!("content/security_suite.md"),
113        )]
114    }
115
116    #[prompt(
117        name = "github_workflow_apps_auth_billing",
118        description = "GitHub Apps/installations, OAuth apps, OIDC, billing, credentials, \
119                        API insights."
120    )]
121    async fn github_workflow_apps_auth_billing_prompt(&self) -> Vec<PromptMessage> {
122        vec![PromptMessage::new_text(
123            Role::User,
124            include_str!("content/apps_auth_billing.md"),
125        )]
126    }
127
128    #[prompt(
129        name = "github_workflow_packages_migrations_gists",
130        description = "Packages, import/export migrations, gists."
131    )]
132    async fn github_workflow_packages_migrations_gists_prompt(&self) -> Vec<PromptMessage> {
133        vec![PromptMessage::new_text(
134            Role::User,
135            include_str!("content/packages_migrations_gists.md"),
136        )]
137    }
138
139    #[prompt(
140        name = "github_workflow_codespaces_copilot",
141        description = "Codespaces, Copilot, Copilot Spaces, agents/agent tasks, GitHub \
142                        Classroom."
143    )]
144    async fn github_workflow_codespaces_copilot_prompt(&self) -> Vec<PromptMessage> {
145        vec![PromptMessage::new_text(
146            Role::User,
147            include_str!("content/codespaces_copilot.md"),
148        )]
149    }
150
151    #[prompt(
152        name = "github_workflow_projects",
153        description = "Projects (v2), campaigns."
154    )]
155    async fn github_workflow_projects_prompt(&self) -> Vec<PromptMessage> {
156        vec![PromptMessage::new_text(
157            Role::User,
158            include_str!("content/projects.md"),
159        )]
160    }
161
162    #[prompt(
163        name = "github_workflow_users_activity",
164        description = "User profile/keys/social graph, activity feed, starring/watching, \
165                        notifications."
166    )]
167    async fn github_workflow_users_activity_prompt(&self) -> Vec<PromptMessage> {
168        vec![PromptMessage::new_text(
169            Role::User,
170            include_str!("content/users_activity.md"),
171        )]
172    }
173
174    #[prompt(
175        name = "github_workflow_meta_diagnostics",
176        description = "Thin pointer to read-only utility signals: API meta, rate limits, \
177                        code search, emojis, gitignore templates, licenses, code-of-conduct \
178                        templates, markdown rendering."
179    )]
180    async fn github_workflow_meta_diagnostics_prompt(&self) -> Vec<PromptMessage> {
181        vec![PromptMessage::new_text(
182            Role::User,
183            include_str!("content/meta_diagnostics.md"),
184        )]
185    }
186}