Skip to content

Commit 0af5ba6

Browse files
committed
update argument prompts
1 parent e3cfbff commit 0af5ba6

File tree

1 file changed

+56
-15
lines changed

1 file changed

+56
-15
lines changed

pkg/github/projects.go

Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,21 @@ func ProjectRead(getClient GetClientFn, t translations.TranslationHelperFunc) (t
3434
3535
Methods: get_project, list_projects, get_project_field, list_project_fields, get_project_item, list_project_items
3636
37-
**For list_project_items:**
38-
1. Call list_project_fields FIRST for field IDs
39-
2. Use 'query' to filter (e.g., 'state:open priority:p1')
40-
3. Use 'fields' with IDs from step 1
41-
42-
Examples: query='state:open priority:p1', query='state:closed priority:p1 milestone:"X" assignee:@me', query='unblocks:*copilot*'`)),
37+
USAGE GUIDANCE (CRITICAL):
38+
1. list_project_fields MUST be called first to discover field IDs before requesting item field values.
39+
2. ALWAYS provide a well‑scoped 'query' when calling list_project_items. Omitting 'query' returns broad mixed results (issues + PRs) and is inefficient.
40+
3. Filter by content type explicitly: add 'is:issue' or 'is:pr' as a qualifier in your query.
41+
4. To retrieve field values for items, pass the discovered IDs via the 'fields' argument on EVERY paginated call; otherwise only titles are returned.
42+
5. PAGINATION: After every list_* call, inspect pageInfo.hasNextPage. If true, immediately call again with the same method, same query, same fields, and after=pageInfo.nextCursor. Repeat until hasNextPage=false. Do not change per_page mid sequence. Use 'before' only when navigating backwards (rare).
43+
6. Accumulate all pages before performing analysis or summarization; partial data leads to incorrect results.
44+
45+
Examples of query usage:
46+
- query='state:open is:issue priority:p1'
47+
- query='is:pr status:"In Review" team-name:"Backend Team"'
48+
- query='is:issue sprint-name:"Q1 Planning" assignee:@me'
49+
- query='unblocks:*copilot* is:issue state:open'
50+
51+
Combine space-separated qualifiers for logical AND; use commas inside a qualifier for OR (e.g., label:bug,critical).`)),
4352
mcp.WithToolAnnotation(mcp.ToolAnnotation{
4453
Title: t("TOOL_PROJECT_READ_USER_TITLE", "Read project information"),
4554
ReadOnlyHint: ToBoolPtr(true),
@@ -68,21 +77,53 @@ Examples: query='state:open priority:p1', query='state:closed priority:p1 milest
6877
mcp.Description("Item ID (required for get_project_item)"),
6978
),
7079
mcp.WithString("query",
71-
mcp.Description("Filter string (CRITICAL for list_project_items). "+
72-
"Combine filters by SPACE for logical AND (order doesn't matter): e.g. 'state:open is:issue priority:p1 label:bug'. "+
73-
"**Content Type:** Use 'is:issue' for issues, 'is:pr' (or 'is:pull-request') for pull requests. "+
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\"'. "+
76-
"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"),
80+
mcp.Description(`Query string to filter project items (highly recommended for list_project_items).
81+
CRITICAL: Always include this when calling list_project_items.
82+
83+
list_project_items instructions:
84+
85+
Derive the query from the user's natural language intent BEFORE invoking the tool. Map phrases directly:
86+
- "open issues" => state:open is:issue
87+
- "merged PRs" => state:merged is:pr
88+
- "assigned to me" => assignee:@me is:issue
89+
- "high priority bugs" => state:open is:issue label:bug priority:high
90+
- "review-ready PRs" => is:pr status:"Ready for Review"
91+
92+
Content Type:
93+
- Issues: is:issue
94+
- Pull requests: is:pr (or is:pull-request)
95+
Without one you'll get mixed types.
96+
97+
Logical Combination:
98+
- Space-separated qualifiers = AND
99+
- Commas inside a single qualifier = OR (label:bug,critical)
100+
- Negation with leading dash: -label:wontfix
101+
102+
Format Rules:
103+
- Qualifiers with spaces use hyphens: sprint-name, team-name, parent-issue
104+
- Values with spaces use quotes: sprint-name:"Q1 Planning" status:"In Review"
105+
- Single word values: no quotes (state:open priority:high)
106+
107+
Examples:
108+
- state:open is:issue sprint-name:"Q1 Planning"
109+
- is:pr team-name:"Backend Team" status:"In Review"
110+
- parent-issue:"github/repo#123"
111+
112+
Common Filters:
113+
is:issue/pr state:open/closed/merged assignee:@me/username label:name status:value priority:p1 updated:>@today-7d title:*text* -label:wontfix label:bug,critical priority:1..3 no:assignee has:label iteration:@current
114+
115+
Pagination:
116+
When pageInfo.hasNextPage=true, use after=nextCursor to request the next page. Keep query, fields, and per_page identical for every page. Repeat until pageInfo.hasNextPage=false.
117+
`),
77118
),
78119
mcp.WithNumber("per_page",
79-
mcp.Description(fmt.Sprintf("Results per page (max %d)", MaxProjectsPerPage)),
120+
mcp.Description(fmt.Sprintf("Results per page (max %d). Keep constant across paginated requests; changing mid-sequence can complicate page traversal.", MaxProjectsPerPage)),
80121
),
81122
mcp.WithString("after",
82-
mcp.Description("Next page cursor (from pageInfo.endCursor)"),
123+
mcp.Description("Forward pagination cursor. Use ONLY if the previous response pageInfo.hasNextPage=true. Supply pageInfo.nextCursor as 'after' and immediately request the next page. LOOP UNTIL pageInfo.hasNextPage=false (don't stop early). Keep query, fields, and per_page identical for every page."),
83124
),
84125
mcp.WithString("before",
85-
mcp.Description("Previous page cursor (from pageInfo.startCursor)"),
126+
mcp.Description("Backward pagination cursor (rare): supply to move to the preceding page using pageInfo.prevCursor. Not needed for normal forward iteration."),
86127
),
87128
mcp.WithArray("fields",
88129
mcp.Description("Field IDs to include (e.g. [\"102589\", \"985201\"]). CRITICAL: Always provide to get field values. Without this, only titles returned. Get IDs from list_project_fields first."),

0 commit comments

Comments
 (0)