Skip to content

Commit cac11f2

Browse files
mattdhollowaySamMorrowDrums
authored andcommitted
exclude tools requiring ff from docs
1 parent 116c574 commit cac11f2

File tree

3 files changed

+30
-45
lines changed

3 files changed

+30
-45
lines changed

README.md

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -492,40 +492,6 @@ The following sets of tools are available:
492492

493493
<summary><picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/workflow-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/workflow-light.png"><img src="pkg/octicons/icons/workflow-light.png" width="20" height="20" alt="workflow"></picture> Actions</summary>
494494

495-
- **actions_get** - Get details of GitHub Actions resources (workflows, workflow runs, jobs, and artifacts)
496-
- `method`: The method to execute (string, required)
497-
- `owner`: Repository owner (string, required)
498-
- `repo`: Repository name (string, required)
499-
- `resource_id`: The unique identifier of the resource. This will vary based on the "method" provided, so ensure you provide the correct ID:
500-
- Provide a workflow ID or workflow file name (e.g. ci.yaml) for 'get_workflow' method.
501-
- Provide a workflow run ID for 'get_workflow_run', 'get_workflow_run_usage', and 'get_workflow_run_logs_url' methods.
502-
- Provide an artifact ID for 'download_workflow_run_artifact' method.
503-
- Provide a job ID for 'get_workflow_job' method.
504-
(string, required)
505-
506-
- **actions_list** - List GitHub Actions workflows in a repository
507-
- `method`: The action to perform (string, required)
508-
- `owner`: Repository owner (string, required)
509-
- `page`: Page number for pagination (default: 1) (number, optional)
510-
- `per_page`: Results per page for pagination (default: 30, max: 100) (number, optional)
511-
- `repo`: Repository name (string, required)
512-
- `resource_id`: The unique identifier of the resource. This will vary based on the "method" provided, so ensure you provide the correct ID:
513-
- Do not provide any resource ID for 'list_workflows' method.
514-
- Provide a workflow ID or workflow file name (e.g. ci.yaml) for 'list_workflow_runs' method, or omit to list all workflow runs in the repository.
515-
- Provide a workflow run ID for 'list_workflow_jobs' and 'list_workflow_run_artifacts' methods.
516-
(string, optional)
517-
- `workflow_jobs_filter`: Filters for workflow jobs. **ONLY** used when method is 'list_workflow_jobs' (object, optional)
518-
- `workflow_runs_filter`: Filters for workflow runs. **ONLY** used when method is 'list_workflow_runs' (object, optional)
519-
520-
- **actions_run_trigger** - Trigger GitHub Actions workflow actions
521-
- `inputs`: Inputs the workflow accepts. Only used for 'run_workflow' method. (object, optional)
522-
- `method`: The method to execute (string, required)
523-
- `owner`: Repository owner (string, required)
524-
- `ref`: The git reference for the workflow. The reference can be a branch or tag name. Required for 'run_workflow' method. (string, optional)
525-
- `repo`: Repository name (string, required)
526-
- `run_id`: The ID of the workflow run. Required for all methods except 'run_workflow'. (number, optional)
527-
- `workflow_id`: The workflow ID (numeric) or workflow file name (e.g., main.yml, ci.yaml). Required for 'run_workflow' method. (string, optional)
528-
529495
- **cancel_workflow_run** - Cancel workflow run
530496
- `owner`: Repository owner (string, required)
531497
- `repo`: Repository name (string, required)
@@ -550,15 +516,6 @@ The following sets of tools are available:
550516
- `run_id`: Workflow run ID (required when using failed_only) (number, optional)
551517
- `tail_lines`: Number of lines to return from the end of the log (number, optional)
552518

553-
- **get_job_logs** - Get GitHub Actions workflow job logs
554-
- `failed_only`: When true, gets logs for all failed jobs in the workflow run specified by run_id. Requires run_id to be provided. (boolean, optional)
555-
- `job_id`: The unique identifier of the workflow job. Required when getting logs for a single job. (number, optional)
556-
- `owner`: Repository owner (string, required)
557-
- `repo`: Repository name (string, required)
558-
- `return_content`: Returns actual log content instead of URLs (boolean, optional)
559-
- `run_id`: The unique identifier of the workflow run. Required when failed_only is true to get logs for all failed jobs in the run. (number, optional)
560-
- `tail_lines`: Number of lines to return from the end of the log (number, optional)
561-
562519
- **get_workflow_run** - Get workflow run
563520
- `owner`: Repository owner (string, required)
564521
- `repo`: Repository name (string, required)

cmd/github-mcp-server/generate_docs.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,10 @@ func generateToolsetsDoc(i *inventory.Inventory) string {
153153
}
154154

155155
func generateToolsDoc(r *inventory.Inventory) string {
156-
// AllTools() returns tools sorted by toolset ID then tool name.
156+
// AllToolsForDocs() returns tools sorted by toolset ID then tool name,
157+
// excluding tools that require feature flags (not available to regular users).
157158
// We iterate once, grouping by toolset as we encounter them.
158-
tools := r.AllTools()
159+
tools := r.AllToolsForDocs()
159160
if len(tools) == 0 {
160161
return ""
161162
}

pkg/inventory/registry.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,33 @@ func (r *Inventory) AllTools() []ServerTool {
266266
return result
267267
}
268268

269+
// AllToolsForDocs returns tools suitable for documentation, sorted deterministically.
270+
// This excludes tools that require a feature flag to be enabled (FeatureFlagEnable),
271+
// since those are not available to regular users and shouldn't appear in public docs.
272+
// Tools that are disabled by a feature flag (FeatureFlagDisable) are still included
273+
// since they are available by default.
274+
func (r *Inventory) AllToolsForDocs() []ServerTool {
275+
var result []ServerTool
276+
for i := range r.tools {
277+
tool := &r.tools[i]
278+
// Skip tools that require a feature flag to enable
279+
if tool.FeatureFlagEnable != "" {
280+
continue
281+
}
282+
result = append(result, *tool)
283+
}
284+
285+
// Sort deterministically: by toolset ID, then by tool name
286+
sort.Slice(result, func(i, j int) bool {
287+
if result[i].Toolset.ID != result[j].Toolset.ID {
288+
return result[i].Toolset.ID < result[j].Toolset.ID
289+
}
290+
return result[i].Tool.Name < result[j].Tool.Name
291+
})
292+
293+
return result
294+
}
295+
269296
// AvailableToolsets returns the unique toolsets that have tools, in sorted order.
270297
// This is the ordered intersection of toolsets with reality - only toolsets that
271298
// actually contain tools are returned, sorted by toolset ID.

0 commit comments

Comments
 (0)