Skip to content

Commit cd6d1a2

Browse files
committed
update server instructions
1 parent 03c84af commit cd6d1a2

File tree

5 files changed

+55
-46
lines changed

5 files changed

+55
-46
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,7 @@ MUST reflect user intent; strongly prefer explicit content type if narrowed:
854854
- "list all P1 priority items" → priority:p1 (omit state if user wants all, omit type if user specifies "items")
855855
- "list all open P2 issues" → is:issue state:open priority:p2 (include state if user wants open or closed, include type if user specifies "issues" or "PRs")
856856
- "all open issues I'm working on" → is:issue state:open assignee:@me
857+
857858
Query Construction Heuristics:
858859
a. Extract type nouns: issues → is:issue | PRs, Pulls, or Pull Requests → is:pr | tasks/tickets → is:issue (ask if ambiguity)
859860
b. Map temporal phrases: "this week" → updated:>@today-7d

pkg/github/__toolsnaps__/list_project_items.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"title": "List project items",
44
"readOnlyHint": true
55
},
6-
"description": "GitHub Projects V2 - List Project Items with advanced filtering and field selection\n\nField usage:\n\n- Call list_project_fields first to get IDs/types.\n- Use EXACT returned field names (case-insensitive match). Don't invent names or IDs.\n- Iteration synonyms (sprint/cycle/iteration) only if that field exists; map to the actual name (e.g. sprint:@current).\n- Only include filters for fields that exist and are relevant.\n\nItem query syntax:\nAND = space | OR = comma (label:bug,critical) | NOT = prefix - ( -label:wontfix )\nQuote multi-word values: status:\"In Review\" team-name:\"Backend Team\"\nHyphenate multi-word field names (story-points).\nRanges: points:1..3 dates:2025-01-01..2025-12-31\nComparisons: updated:\u003e@today-7d priority:\u003e1 points:\u003c=10\nWildcards: title:*crash* label:bug*\nTemporal shortcuts: @today @today-7d @today-30d\nIteration shortcuts: @current @next @previous\n\nPagination (mandatory):\nLoop while pageInfo.hasNextPage=true using after=nextCursor. Keep query, fields, per_page IDENTICAL each page.\n\nFields parameter:\nInclude field IDs on EVERY paginated list_project_items call if you need values. Omit → title only.\n\nCounting rules:\n- Count items array length after full pagination.\n- If multi-page: collect all pages, dedupe by item.id (fallback node_id) before totals.\n- Never count field objects, content, or nested arrays as separate items.\n- item.id = project item ID (for updates/deletes). item.content.id = underlying issue/PR ID.\n\nSummary vs list:\n- Summaries ONLY if user uses verbs: analyze | summarize | summary | report | overview | insights.\n- Listing verbs (list/show/get/fetch/display/enumerate) → just enumerate + total.\n\nExamples:\nlist_projects: \"roadmap is:open\"\nlist_project_items: state:open is:issue sprint:@current priority:high updated:\u003e@today-7d\n\nSelf-check before returning:\n☑ Paginated fully ☑ Dedupe by id/node_id ☑ Correct IDs used ☑ Field names valid ☑ Summary only if requested.\n\nReturn COMPLETE data or state what's missing (e.g. pages skipped).",
6+
"description": "Search project items with advanced filtering",
77
"inputSchema": {
88
"properties": {
99
"after": {
@@ -42,7 +42,7 @@
4242
"type": "number"
4343
},
4444
"query": {
45-
"description": "Query string - For advanced filtering of project items using GitHub's search syntax:\n\nMUST reflect user intent; strongly prefer explicit content type if narrowed:\n\t- \"open issues\" → state:open is:issue\n\t- \"merged PRs\" → state:merged is:pr\n\t- \"items updated this week\" → updated:\u003e@today-7d (omit type only if mixed desired)\n\t- \"list all P1 priority items\" → priority:p1 (omit state if user wants all, omit type if user specifies \"items\")\n\t- \"list all open P2 issues\" → is:issue state:open priority:p2 (include state if user wants open or closed, include type if user specifies \"issues\" or \"PRs\")\n\t- \"all open issues I'm working on\" → is:issue state:open assignee:@me\nQuery Construction Heuristics:\n\ta. Extract type nouns: issues → is:issue | PRs, Pulls, or Pull Requests → is:pr | tasks/tickets → is:issue (ask if ambiguity)\n\tb. Map temporal phrases: \"this week\" → updated:\u003e@today-7d\n\tc. Map negations: \"excluding wontfix\" → -label:wontfix\n\td. Map priority adjectives: \"high/sev1/p1\" → priority:high OR priority:p1 (choose based on field presence)\n\nSyntax Essentials (items):\n AND: space-separated. (label:bug priority:high).\n OR: comma inside one qualifier (label:bug,critical).\n NOT: leading '-' (-label:wontfix).\n Hyphenate multi-word field names. (team-name:\"Backend Team\", story-points:\u003e5).\n Quote multi-word values. (status:\"In Review\" team-name:\"Backend Team\").\n Ranges: points:1..3, updated:\u003c@today-30d.\n Wildcards: title:*crash*, label:bug*.\n\t Assigned to User: assignee:@me | assignee:username | no:assignee\n\nCommon Qualifier Glossary (items):\n is:issue | is:pr | state:open|closed|merged | assignee:@me|username | label:NAME | status:VALUE |\n priority:p1|high | sprint-name:@current | team-name:\"Backend Team\" | parent-issue:\"org/repo#123\" |\n updated:\u003e@today-7d | title:*text* | -label:wontfix | label:bug,critical | no:assignee | has:label\n\nPagination Mandate:\n Do not analyze until ALL pages fetched (loop while pageInfo.hasNextPage=true). Always reuse identical query, fields, per_page.\n\nRecovery Guidance:\n If user provides ambiguous request (\"show project activity\") → ask clarification OR return mixed set (omit is:issue/is:pr). If user mixes project + item qualifiers in one phrase → split: run list_projects for discovery, then list_project_items for detail.\n\nNever:\n - Infer field IDs; fetch via list_project_fields.\n - Drop 'fields' param on subsequent pages if field values are needed.",
45+
"description": "Query string - For advanced filtering of project items using GitHub's search syntax:\n\nMUST reflect user intent; strongly prefer explicit content type if narrowed:\n\t- \"open issues\" → state:open is:issue\n\t- \"merged PRs\" → state:merged is:pr\n\t- \"items updated this week\" → updated:\u003e@today-7d (omit type only if mixed desired)\n\t- \"list all P1 priority items\" → priority:p1 (omit state if user wants all, omit type if user specifies \"items\")\n\t- \"list all open P2 issues\" → is:issue state:open priority:p2 (include state if user wants open or closed, include type if user specifies \"issues\" or \"PRs\")\n\t- \"all open issues I'm working on\" → is:issue state:open assignee:@me\n\nQuery Construction Heuristics:\n\ta. Extract type nouns: issues → is:issue | PRs, Pulls, or Pull Requests → is:pr | tasks/tickets → is:issue (ask if ambiguity)\n\tb. Map temporal phrases: \"this week\" → updated:\u003e@today-7d\n\tc. Map negations: \"excluding wontfix\" → -label:wontfix\n\td. Map priority adjectives: \"high/sev1/p1\" → priority:high OR priority:p1 (choose based on field presence)\n\nSyntax Essentials (items):\n AND: space-separated. (label:bug priority:high).\n OR: comma inside one qualifier (label:bug,critical).\n NOT: leading '-' (-label:wontfix).\n Hyphenate multi-word field names. (team-name:\"Backend Team\", story-points:\u003e5).\n Quote multi-word values. (status:\"In Review\" team-name:\"Backend Team\").\n Ranges: points:1..3, updated:\u003c@today-30d.\n Wildcards: title:*crash*, label:bug*.\n\t Assigned to User: assignee:@me | assignee:username | no:assignee\n\nCommon Qualifier Glossary (items):\n is:issue | is:pr | state:open|closed|merged | assignee:@me|username | label:NAME | status:VALUE |\n priority:p1|high | sprint-name:@current | team-name:\"Backend Team\" | parent-issue:\"org/repo#123\" |\n updated:\u003e@today-7d | title:*text* | -label:wontfix | label:bug,critical | no:assignee | has:label\n\nPagination Mandate:\n Do not analyze until ALL pages fetched (loop while pageInfo.hasNextPage=true). Always reuse identical query, fields, per_page.\n\nRecovery Guidance:\n If user provides ambiguous request (\"show project activity\") → ask clarification OR return mixed set (omit is:issue/is:pr). If user mixes project + item qualifiers in one phrase → split: run list_projects for discovery, then list_project_items for detail.\n\nNever:\n - Infer field IDs; fetch via list_project_fields.\n - Drop 'fields' param on subsequent pages if field values are needed.",
4646
"type": "string"
4747
}
4848
},

pkg/github/__toolsnaps__/list_projects.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"title": "List projects",
44
"readOnlyHint": true
55
},
6-
"description": "List Projects for a user or organization ",
6+
"description": "List Projects for a user or organization",
77
"inputSchema": {
88
"properties": {
99
"after": {

pkg/github/instructions.go

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,55 @@ Check 'list_issue_types' first for organizations to use proper issue types. Use
6262
return `## Discussions
6363
6464
Use 'list_discussion_categories' to understand available categories before creating discussions. Filter by category for better organization.`
65+
case "projects":
66+
return `## Projects
67+
68+
When using 'list_project_items', follow the these guidelines:
69+
70+
Field usage:
71+
- Call list_project_fields first to understand available fields and get IDs/types before filtering.
72+
- Use EXACT returned field names (case-insensitive match). Don't invent names or IDs.
73+
- Iteration synonyms (sprint/cycle/iteration) only if that field exists; map to the actual name (e.g. sprint:@current).
74+
- Only include filters for fields that exist and are relevant.
75+
76+
Item query syntax:
77+
- AND = space | OR = comma (label:bug,critical) | NOT = prefix - ( -label:wontfix )
78+
- Quote multi-word values: status:"In Review" team-name:"Backend Team"
79+
- Hyphenate multi-word field names (story-points).
80+
- Ranges: points:1..3 dates:2025-01-01..2025-12-31
81+
- Comparisons: updated:>@today-7d priority:>1 points:<=10
82+
- Wildcards: title:*crash* label:bug*
83+
- Temporal shortcuts: @today @today-7d @today-30d
84+
- Iteration shortcuts: @current @next @previous
85+
86+
Pagination (mandatory):
87+
- Loop while pageInfo.hasNextPage=true using after=nextCursor. Keep query, fields, per_page IDENTICAL each page.
88+
89+
Fields parameter:
90+
- Include field IDs on EVERY paginated list_project_items call if you need values. Omit → title only.
91+
92+
Counting rules:
93+
- Count items array length after full pagination.
94+
- If multi-page: collect all pages, dedupe by item.id (fallback node_id) before totals.
95+
- Never count field objects, content, or nested arrays as separate items.
96+
- item.id = project item ID (for updates/deletes). item.content.id = underlying issue/PR ID.
97+
98+
Summary vs list:
99+
- Summaries ONLY if user uses verbs: analyze | summarize | summary | report | overview | insights.
100+
- Listing verbs (list/show/get/fetch/display/enumerate) → just enumerate + total.
101+
102+
Examples:
103+
- list_projects: "roadmap is:open"
104+
- list_project_items: state:open is:issue sprint:@current priority:high updated:>@today-7d
105+
106+
Self-check before returning:
107+
- Paginated fully
108+
- Dedupe by id/node_id
109+
- Correct IDs used
110+
- Field names valid
111+
- Summary only if requested.
112+
113+
Return COMPLETE data or state what's missing (e.g. pages skipped).`
65114
default:
66115
return ""
67116
}

pkg/github/projects.go

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -392,49 +392,7 @@ func GetProjectField(getClient GetClientFn, t translations.TranslationHelperFunc
392392

393393
func ListProjectItems(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
394394
return mcp.NewTool("list_project_items",
395-
mcp.WithDescription(t("TOOL_LIST_PROJECT_ITEMS_DESCRIPTION", `GitHub Projects V2 - List Project Items with advanced filtering and field selection
396-
397-
Field usage:
398-
399-
- Call list_project_fields first to get IDs/types.
400-
- Use EXACT returned field names (case-insensitive match). Don't invent names or IDs.
401-
- Iteration synonyms (sprint/cycle/iteration) only if that field exists; map to the actual name (e.g. sprint:@current).
402-
- Only include filters for fields that exist and are relevant.
403-
404-
Item query syntax:
405-
AND = space | OR = comma (label:bug,critical) | NOT = prefix - ( -label:wontfix )
406-
Quote multi-word values: status:"In Review" team-name:"Backend Team"
407-
Hyphenate multi-word field names (story-points).
408-
Ranges: points:1..3 dates:2025-01-01..2025-12-31
409-
Comparisons: updated:>@today-7d priority:>1 points:<=10
410-
Wildcards: title:*crash* label:bug*
411-
Temporal shortcuts: @today @today-7d @today-30d
412-
Iteration shortcuts: @current @next @previous
413-
414-
Pagination (mandatory):
415-
Loop while pageInfo.hasNextPage=true using after=nextCursor. Keep query, fields, per_page IDENTICAL each page.
416-
417-
Fields parameter:
418-
Include field IDs on EVERY paginated list_project_items call if you need values. Omit → title only.
419-
420-
Counting rules:
421-
- Count items array length after full pagination.
422-
- If multi-page: collect all pages, dedupe by item.id (fallback node_id) before totals.
423-
- Never count field objects, content, or nested arrays as separate items.
424-
- item.id = project item ID (for updates/deletes). item.content.id = underlying issue/PR ID.
425-
426-
Summary vs list:
427-
- Summaries ONLY if user uses verbs: analyze | summarize | summary | report | overview | insights.
428-
- Listing verbs (list/show/get/fetch/display/enumerate) → just enumerate + total.
429-
430-
Examples:
431-
list_projects: "roadmap is:open"
432-
list_project_items: state:open is:issue sprint:@current priority:high updated:>@today-7d
433-
434-
Self-check before returning:
435-
☑ Paginated fully ☑ Dedupe by id/node_id ☑ Correct IDs used ☑ Field names valid ☑ Summary only if requested.
436-
437-
Return COMPLETE data or state what's missing (e.g. pages skipped).`)),
395+
mcp.WithDescription(t("TOOL_LIST_PROJECT_ITEMS_DESCRIPTION", `Search project items with advanced filtering`)),
438396
mcp.WithToolAnnotation(mcp.ToolAnnotation{
439397
Title: t("TOOL_LIST_PROJECT_ITEMS_USER_TITLE", "List project items"),
440398
ReadOnlyHint: ToBoolPtr(true),
@@ -461,6 +419,7 @@ MUST reflect user intent; strongly prefer explicit content type if narrowed:
461419
- "list all P1 priority items" → priority:p1 (omit state if user wants all, omit type if user specifies "items")
462420
- "list all open P2 issues" → is:issue state:open priority:p2 (include state if user wants open or closed, include type if user specifies "issues" or "PRs")
463421
- "all open issues I'm working on" → is:issue state:open assignee:@me
422+
464423
Query Construction Heuristics:
465424
a. Extract type nouns: issues → is:issue | PRs, Pulls, or Pull Requests → is:pr | tasks/tickets → is:issue (ask if ambiguity)
466425
b. Map temporal phrases: "this week" → updated:>@today-7d

0 commit comments

Comments
 (0)