You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// TestMCPOperationDescriptionExtraction tests that the MCP server properly extracts
566
+
// descriptions from GraphQL operations and uses them for tool descriptions
567
+
t.Run("Extract descriptions from GraphQL operations", func(t*testing.T) {
568
+
// Create a temporary directory for test operations
569
+
tempDir:=t.TempDir()
570
+
571
+
// Create test operation files
572
+
testCases:= []struct {
573
+
namestring
574
+
filenamestring
575
+
contentstring
576
+
expectedDescstring
577
+
expectDescEmptybool
578
+
}{
579
+
{
580
+
name: "operation with multi-line description",
581
+
filename: "FindUser.graphql",
582
+
content: `"""
583
+
Finds a user by their unique identifier.
584
+
Returns comprehensive user information including profile and settings.
585
+
586
+
Required permissions: user:read
587
+
"""
588
+
query FindUser($id: ID!) {
589
+
user(id: $id) {
590
+
id
591
+
name
592
+
email
593
+
}
594
+
}`,
595
+
expectedDesc: "Finds a user by their unique identifier.\nReturns comprehensive user information including profile and settings.\n\nRequired permissions: user:read",
596
+
},
597
+
{
598
+
name: "operation with single-line description",
599
+
filename: "GetProfile.graphql",
600
+
content: `"""Gets the current user's profile"""
601
+
query GetProfile {
602
+
me {
603
+
id
604
+
name
605
+
}
606
+
}`,
607
+
expectedDesc: "Gets the current user's profile",
608
+
},
609
+
{
610
+
name: "operation without description",
611
+
filename: "ListUsers.graphql",
612
+
content: `query ListUsers {
613
+
users {
614
+
id
615
+
name
616
+
}
617
+
}`,
618
+
expectDescEmpty: true,
619
+
},
620
+
{
621
+
name: "mutation with description",
622
+
filename: "CreateUser.graphql",
623
+
content: `"""
624
+
Creates a new user in the system.
625
+
Requires admin privileges.
626
+
"""
627
+
mutation CreateUser($input: UserInput!) {
628
+
createUser(input: $input) {
629
+
id
630
+
name
631
+
}
632
+
}`,
633
+
expectedDesc: "Creates a new user in the system.\nRequires admin privileges.",
0 commit comments