Skip to content

Commit f78b329

Browse files
committed
prompt updates
1 parent 2459b9c commit f78b329

File tree

1 file changed

+56
-33
lines changed

1 file changed

+56
-33
lines changed

pkg/github/projects.go

Lines changed: 56 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ Examples: query='state:open priority:p1', query='state:closed priority:p1 milest
7171
mcp.Description("Filter string (CRITICAL for list_project_items). "+
7272
"Combine filters by SPACE for logical AND (order doesn't matter): e.g. 'state:open is:issue priority:p1 label:bug'. "+
7373
"**Content Type:** Use 'is:issue' for issues, 'is:pr' (or 'is:pull-request') for pull requests. "+
74-
"Examples: 'state:open is:issue priority:p1', 'state:closed is:pr label:bug', 'state:open is:issue assignee:@me', 'is:pr label:bug priority:high'. "+
75-
"Field names with spaces use hyphens (e.g., 'parent-issue:\"github/github-mcp-server#1234\"'). "+
74+
"**Format Rules:** Qualifiers (left of ':') with spaces use hyphens. Values (right of ':') with spaces use quotes. "+
75+
"Examples: 'state:open is:issue sprint-name:\"Q1 Planning\"', 'is:pr team-name:\"Backend Team\" status:\"In Review\"', 'parent-issue:\"github/repo#123\"'. "+
7676
"Filters: is:issue/pr/open/closed/merged, assignee:@me/username, label:name, status:value, priority:p1, updated:>@today-7d, title:*text*, -label:wontfix (negate), label:bug,critical (OR with comma), priority:1..3 (range), no:assignee, has:label, iteration:@current"),
7777
),
7878
mcp.WithNumber("per_page",
@@ -952,17 +952,20 @@ func ManageProjectItemsPrompt(t translations.TranslationHelperFunc) (tool mcp.Pr
952952
Content: mcp.NewTextContent("You are a GitHub Projects V2 management assistant.\n\n" +
953953
"**CRITICAL Rules:**\n" +
954954
"1. Call list_project_fields FIRST for field IDs\n" +
955-
"2. Use 'query' in list_project_items (e.g., 'state:open is:issue priority:p1' for issues, 'is:pr label:bug' for PRs)\n" +
955+
"2. Use 'query' in list_project_items with proper formatting (see Filter Format below)\n" +
956956
"3. Use 'fields' with IDs to get values\n" +
957957
"4. **⚠️ ALWAYS check pageInfo.hasNextPage and fetch ALL pages** - incomplete data = wrong results!\n\n" +
958+
"**Filter Format Rules:**\n" +
959+
"- Qualifiers (left side of ':') with spaces use hyphens: 'sprint-name', 'parent-issue', 'team-name'\n" +
960+
"- Values (right side of ':') with spaces must be quoted: 'sprint-name:\"Q1 Planning\"', 'status:\"In Review\"'\n" +
961+
"- Single-word values don't need quotes: 'state:open', 'priority:high'\n" +
962+
"Examples: 'is:issue sprint-name:\"Q1 Planning\" status:\"In Progress\"', 'is:pr team-name:\"Backend Team\"', 'parent-issue:\"github/repo#123\"'\n\n" +
958963
"**Content Type Filtering:** Projects contain both issues and pull requests. ALWAYS filter by type:\n" +
959964
"- For issues: Add 'is:issue' to query (e.g., 'state:open is:issue')\n" +
960965
"- For PRs: Add 'is:pr' to query (e.g., 'is:merged is:pr')\n" +
961966
"- Without type filter, you'll get both mixed together\n\n" +
962-
"**Filter Combination:** Space-separated filters are logical AND. Order does not matter. Example: 'state:open is:issue assignee:@me priority:p1'. Use commas for OR inside a single qualifier (e.g., 'label:bug,critical').\n\n" +
963-
"- **Content Type:** Used in conjunction with state filters: 'is:issue, state:open'\n" +
967+
"**Filter Combination:** Space-separated filters are logical AND. Order does not matter. Use commas for OR inside a single qualifier (e.g., 'label:bug,critical').\n" +
964968
"**Pagination Rule:** If hasNextPage=true, you MUST call again with after=nextCursor. Repeat until hasNextPage=false.\n\n" +
965-
"**Query examples:** 'state:open is:issue priority:p1', 'state:closed is:pr assignee:@me', 'state:open is:issue unblocks:*copilot*'\n\n" +
966969
"- ⚠️ ALWAYS combine query filters for precise results (avoid under-filtering)\n" +
967970
"**Tools:** project_read (read), project_write (update)\n" +
968971
"**For details:** Use issue_read or pull_request_read after getting project items."),
@@ -995,12 +998,17 @@ func ManageProjectItemsPrompt(t translations.TranslationHelperFunc) (tool mcp.Pr
995998
" - **Content type (CRITICAL):** Always filter by type:\n" +
996999
" - Issues: 'is:issue' (e.g., 'state:open is:issue', 'state:open is:issue assignee:@me')\n" +
9971000
" - PRs: 'is:pr' (e.g., 'is:merged is:pr', 'is:pr label:bug')\n" +
998-
" - query=\"is:issue assignee:@me state:open\"\n" +
999-
" - query=\"is:pr status:\"In Progress\" label:bug\"\n" +
1000-
" - query=\"is:issue priority:>1 updated:>@today-7d\"\n" +
1001-
" - query=\"is:issue -is:archived -label:wontfix\" (negation)\n" +
1002-
" - query=\"is:pr label:bug,enhancement\" (OR)\n" +
1003-
" - query=\"is:issue parent-issue:github/github-mcp-server#1234\" (field names with spaces use hyphens)\n" +
1001+
" - **Query format:**\n" +
1002+
" - Qualifiers with spaces use hyphens: 'sprint-name', 'dev-phase', 'parent-issue'\n" +
1003+
" - Values with spaces use quotes: 'sprint-name:\"Q1 Planning\"', 'dev-phase:\"In Progress\"'\n" +
1004+
" - Examples:\n" +
1005+
" - query=\"is:issue assignee:@me dev-phase:\"Ready for Review\"\"\n" +
1006+
" - query=\"is:pr team-name:\"Backend Team\" status:\"In Review\"\"\n" +
1007+
" - query=\"is:issue sprint-name:\"Sprint 12\" priority:high\"\n" +
1008+
" - query=\"is:issue priority:>1 updated:>@today-7d\"\n" +
1009+
" - query=\"is:issue -is:archived -label:wontfix\" (negation)\n" +
1010+
" - query=\"is:pr label:bug,enhancement\" (OR)\n" +
1011+
" - query=\"is:issue parent-issue:\"github/github-mcp-server#1234\"\"\n" +
10041012
" - Combine filters via spaces for AND: e.g., 'state:open is:issue assignee:@me priority:p1'\n" +
10051013
" - fields=[\"198354254\", \"198354255\"] (from step 1)\n\n" +
10061014
"**⚠️ PAGINATION IS CRITICAL:**\n" +
@@ -1009,7 +1017,7 @@ func ManageProjectItemsPrompt(t translations.TranslationHelperFunc) (tool mcp.Pr
10091017
"- Keep same query & fields parameters on subsequent calls\n" +
10101018
"- Continue fetching until hasNextPage=false to get ALL results\n" +
10111019
"- NOT checking pagination means INCOMPLETE data and INCORRECT analysis\n\n" +
1012-
"**Tips:** Always use 'query' to filter at API (faster), always specify 'fields' to get values. Field names with spaces use hyphen separators (e.g., 'parent issue' → 'parent-issue')."),
1020+
"**Tips:** Always use 'query' to filter at API (faster), always specify 'fields' to get values."),
10131021
},
10141022
{
10151023
Role: "user",
@@ -1034,9 +1042,13 @@ func ManageProjectItemsPrompt(t translations.TranslationHelperFunc) (tool mcp.Pr
10341042
Content: mcp.NewTextContent(fmt.Sprintf("**Workflow:**\n\n"+
10351043
"1. List: project_read method=\"list_projects\" owner=\"%s\" owner_type=\"%s\"\n"+
10361044
"2. Fields: project_read method=\"list_project_fields\" project_number=123\n"+
1037-
"3. Query: project_read method=\"list_project_items\" project_number=123 query=\"state:open is:issue assignee:@me\" fields=[\"198354254\",...]\n"+
1038-
" - Combine filters: 'state:open is:issue priority:p1'\n"+
1039-
" - Use 'is:issue' for issues or 'is:pr' for pull requests\n"+
1045+
"3. Query: project_read method=\"list_project_items\" project_number=123\n"+
1046+
" - Filter format: qualifiers use hyphens, values with spaces use quotes\n"+
1047+
" - Examples:\n"+
1048+
" - query=\"state:open is:issue sprint-name:\"Q1 Planning\" assignee:@me\"\n"+
1049+
" - query=\"is:pr dev-phase:\"Ready for Review\" team-name:\"Backend Team\"\"\n"+
1050+
" - Always include content type: 'is:issue' for issues or 'is:pr' for pull requests\n"+
1051+
" - fields=[\"198354254\",...]\n"+
10401052
"4. **⚠️ CRITICAL - Check pagination:** If pageInfo.hasNextPage=true, MUST repeat step 3 with after=pageInfo.nextCursor (keep same query/fields)\n"+
10411053
"5. **Continue fetching:** Repeat step 4 for EVERY page until hasNextPage=false - this ensures you have ALL items\n"+
10421054
"6. Update: project_write method=\"update_project_item\" project_number=123 item_id=789123 updated_field={\"id\": 198354254, \"value\": 18498754}\n\n"+
@@ -1061,13 +1073,13 @@ func ManageProjectItemsPrompt(t translations.TranslationHelperFunc) (tool mcp.Pr
10611073
"- Partial results = flawed decisions\n\n" +
10621074
"**Example Workflow:**\n" +
10631075
"```\n" +
1064-
"Page 1: list_project_items query=\"state:open is:issue\" fields=[\"123\"]\n" +
1076+
"Page 1: list_project_items query=\"state:open is:issue sprint-name:\\\"Sprint 12\\\"\" fields=[\"123\"]\n" +
10651077
"Response: {items: [20 items], pageInfo: {hasNextPage: true, nextCursor: \"abc123\"}}\n" +
10661078
"→ hasNextPage is TRUE - MUST fetch page 2!\n\n" +
1067-
"Page 2: list_project_items query=\"state:open is:issue\" fields=[\"123\"] after=\"abc123\"\n" +
1079+
"Page 2: list_project_items query=\"state:open is:issue sprint-name:\\\"Sprint 12\\\"\" fields=[\"123\"] after=\"abc123\"\n" +
10681080
"Response: {items: [20 items], pageInfo: {hasNextPage: true, nextCursor: \"def456\"}}\n" +
10691081
"→ hasNextPage is TRUE - MUST fetch page 3!\n\n" +
1070-
"Page 3: list_project_items query=\"state:open is:issue\" fields=[\"123\"] after=\"def456\"\n" +
1082+
"Page 3: list_project_items query=\"state:open is:issue sprint-name:\\\"Sprint 12\\\"\" fields=[\"123\"] after=\"def456\"\n" +
10711083
"Response: {items: [8 items], pageInfo: {hasNextPage: false}}\n" +
10721084
"→ hasNextPage is FALSE - now you have ALL 48 items!\n" +
10731085
"```\n\n" +
@@ -1088,25 +1100,28 @@ func ManageProjectItemsPrompt(t translations.TranslationHelperFunc) (tool mcp.Pr
10881100
{
10891101
Role: "assistant",
10901102
Content: mcp.NewTextContent("**Query Building for Reports:**\n\n" +
1103+
"**Filter Format Rules:**\n" +
1104+
"- Qualifiers (left of ':') with spaces: use hyphens (e.g., 'sprint-name', 'dev-phase', 'parent-issue')\n" +
1105+
"- Values (right of ':') with spaces: wrap in quotes (e.g., 'sprint-name:\"Q1 Planning\"', 'dev-phase:\"In Progress\"')\n" +
1106+
"- Single-word values: no quotes needed (e.g., 'state:open', 'priority:high')\n\n" +
10911107
"**ALWAYS specify content type first:**\n" +
10921108
"- User asks about 'issues' → Start query with 'is:issue'\n" +
10931109
"- User asks about 'pull requests' or 'PRs' → Start query with 'is:pr'\n" +
1094-
"- User asks about 'items' (no type specified) → Include both or ask for clarification\n" +
1095-
"- Content type filters can be used with any other filters, e.g. 'state:open is:issue label:bug'\n\n" +
1096-
"Analyze request → build filters:\n" +
1097-
"- 'blocked issues' → 'is:issue label:blocked state:open' or 'is:issue status:blocked state:open'\n" +
1110+
"- User asks about 'items' (no type specified) → Include both or ask for clarification\n\n" +
1111+
"**Common Query Patterns:**\n" +
1112+
"- 'blocked issues' → 'is:issue label:blocked state:open' or 'is:issue dev-phase:blocked state:open'\n" +
10981113
"- 'overdue tasks' → 'is:issue due-date:<@today state:open'\n" +
1099-
"- 'PRs ready for review' → 'is:pr status:\"Ready for Review\" -is:draft state:open'\n" +
1114+
"- 'PRs ready for review' → 'is:pr review-status:\"Ready for Review\" state:open'\n" +
11001115
"- 'stale issues' → 'is:issue updated:<@today-30d state:open'\n" +
11011116
"- 'high priority bugs' → 'is:issue label:bug priority:high state:open'\n" +
1102-
"- 'team PRs' → 'is:pr assignee:user1,user2 iteration:@current'\n" +
1103-
"- 'milestone tracking' → 'is:issue parent-issue:\"github/github-mcp-server#1234\" state:open' (use hyphens for spaces)\n\n" +
1117+
"- 'team PRs' → 'is:pr team-name:\"Backend Team\" iteration:@current'\n" +
1118+
"- 'sprint tracking' → 'is:issue sprint-name:\"Sprint 12\" state:open'\n" +
1119+
"- 'sub-issue tracking' → 'is:issue parent-issue:\"github/github-mcp-server#1234\" state:open'\n\n" +
11041120
"**Field Selection:**\n" +
11051121
"- Status reports: Status, Assignee, Updated Date\n" +
11061122
"- Priority analysis: Priority, Status, Assignee\n" +
11071123
"- Sprint planning: Iteration, Status, Story Points, Assignee\n" +
1108-
"- Blockers: Status, Priority, Assignee, Labels\n\n" +
1109-
"**Note:** Custom field names with spaces use hyphen separators in queries."),
1124+
"- Blockers: Status, Priority, Assignee, Labels"),
11101125
},
11111126
{
11121127
Role: "user",
@@ -1115,17 +1130,25 @@ func ManageProjectItemsPrompt(t translations.TranslationHelperFunc) (tool mcp.Pr
11151130
{
11161131
Role: "assistant",
11171132
Content: mcp.NewTextContent("**Filter Reference:**\n\n" +
1118-
"**Qualifiers:** assignee:@me, label:NAME, milestone:\"NAME\", FIELD:VALUE\n" +
1119-
"**Field Names:** Use hyphens for spaces (e.g., 'parent issue' → 'parent-issue:\"github/github-mcp-server#1234\"')\n" +
1120-
"**State:** state:open/closed/merged, reason:completed\n" +
1121-
"**Content Type:** Used in conjunction with state filters: is:issue, is:pr\n" +
1133+
"**Format Rules:**\n" +
1134+
"- **Qualifiers** (left of ':'): Multi-word qualifiers use hyphens\n" +
1135+
" Examples: 'sprint-name', 'dev-phase', 'parent-issue', 'team-name', 'story-points'\n" +
1136+
"- **Values** (right of ':'): Values with spaces must be in quotes\n" +
1137+
" Examples: 'sprint-name:\"Q1 Planning\"', 'dev-phase:\"In Progress\"', 'team-name:\"Backend Team\"'\n" +
1138+
"- **Single words**: No quotes or hyphens needed\n" +
1139+
" Examples: 'state:open', 'priority:high', 'assignee:@me'\n\n" +
1140+
"**Common Qualifiers:**\n" +
1141+
"- assignee:@me/username\n" +
1142+
"- label:NAME (use quotes if NAME has spaces: label:\"bug fix\")\n" +
1143+
"- Custom fields with spaces: sprint-name:\"VALUE\", dev-phase:\"VALUE\", parent-issue:\"github/repo#123\"\n\n" +
1144+
"**State & Type:** state:open/closed/merged, is:issue/pr, reason:completed\n" +
11221145
"**Comparison:** >1, >=1, <3, <=3, 1..3, *..10\n" +
11231146
"**Date:** @today, @today-1d/1w/30d, 2024-01-01, updated:>@today-7d\n" +
11241147
"**Iteration:** @current, @next, @previous, iteration:@current..@current+2\n" +
11251148
"**Logic:** -label:wontfix (NOT), label:bug,critical (OR), assignee:u1 assignee:u2 (AND)\n" +
11261149
"**Presence:** has:assignee, no:label, -no:FIELD (must have)\n" +
11271150
"**Text:** title:*text*, label:bug* (wildcards)\n\n" +
1128-
"Start broad, narrow with negation. Always use 'query' parameter for API-level filtering."),
1151+
"Always use 'query' parameter for API-level filtering."),
11291152
},
11301153
}
11311154
return &mcp.GetPromptResult{

0 commit comments

Comments
 (0)