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
6 changes: 5 additions & 1 deletion pkg/github/toolset_instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import "github.com/github/github-mcp-server/pkg/inventory"
// They are called during inventory build to generate server instructions.

func generateContextToolsetInstructions(_ *inventory.Inventory) string {
return "Always call 'get_me' first to understand current user permissions and context."
return `Always call 'get_me' first to understand current user permissions and context.

## GitHub Autolinked References

When creating issues, pull requests, comments, or discussions, use GitHub's autolinked reference syntax: issue numbers (#123), user mentions (@example-username), and cross-repository references (example-owner/example-repo#123). GitHub renders these references as links automatically. See the official documentation for complete details: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/autolinked-references-and-urls`
}

func generateIssuesToolsetInstructions(_ *inventory.Inventory) string {
Expand Down
23 changes: 23 additions & 0 deletions pkg/github/toolset_instructions_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package github

import (
"strings"
"testing"

"github.com/github/github-mcp-server/pkg/inventory"
)

func TestGenerateContextToolsetInstructionsIncludesAutolinkGuidance(t *testing.T) {
instructions := generateContextToolsetInstructions(&inventory.Inventory{})

for _, expected := range []string{
"#123",
"@example-username",
"example-owner/example-repo#123",
"https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/autolinked-references-and-urls",
} {
if !strings.Contains(instructions, expected) {
t.Fatalf("expected context instructions to include %q, got %q", expected, instructions)
}
}
}