Skip to content

Commit 17e3a86

Browse files
committed
prompt updates
1 parent 0cff0b8 commit 17e3a86

File tree

1 file changed

+104
-57
lines changed

1 file changed

+104
-57
lines changed

pkg/github/projects.go

Lines changed: 104 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ MUST reflect user intent; strongly prefer explicit content type if narrowed:
460460
- "items updated this week" → updated:>@today-7d (omit type only if mixed desired)
461461
- "list all P1 priority items" → priority:p1 (omit state if user wants all, omit type if user speciifies "items")
462462
- "list all open P2 issues" → is:issue state:open priority:p2 (include state if user wants open or closed, include type if user speciifies "issues" or "PRs")
463+
- "all open issues I'm working on" → is:issue state:open assignee:@me
463464
Query Construction Heuristics:
464465
a. Extract type nouns: issues → is:issue | PRs, Pulls, or Pull Requests → is:pr | tasks/tickets → is:issue (ask if ambiguity)
465466
b. Map temporal phrases: "this week" → updated:>@today-7d
@@ -474,6 +475,7 @@ Syntax Essentials (items):
474475
Quote multi-word values. (status:"In Review" team-name:"Backend Team").
475476
Ranges: points:1..3, updated:<@today-30d.
476477
Wildcards: title:*crash*, label:bug*.
478+
Assigned to User: assignee:@me | assignee:username | no:assignee
477479
478480
Common Qualifier Glossary (items):
479481
is:issue | is:pr | state:open|closed|merged | assignee:@me|username | label:NAME | status:VALUE |
@@ -1255,40 +1257,52 @@ func ManageProjectItemsPrompt(t translations.TranslationHelperFunc) (tool mcp.Pr
12551257
{
12561258
Role: "system",
12571259
Content: mcp.NewTextContent(`System guide: GitHub Projects V2.
1258-
Goal: Pick correct method, fetch COMPLETE data (no early pagination stop), apply accurate filters, and count items correctly.
1260+
Goal: Pick correct tool, fetch COMPLETE data (no early pagination stop), apply accurate filters, and count items correctly.
12591261
1260-
Method quick map:
1261-
list_projects (metadata only) | get_project (single) | list_project_fields (define IDs) | get_project_field | list_project_items (issues/PRs) | get_project_item | project_write (mutations) | issue_read / pull_request_read (deep details)
1262+
Available tools (9 total):
1263+
1264+
Read-only tools:
1265+
- list_projects: List all projects for a user/org
1266+
- get_project: Get details of a single project by project_number
1267+
- list_project_fields: List all fields in a project (CALL THIS FIRST before filtering)
1268+
- get_project_field: Get details of a single field by field_id
1269+
- list_project_items: List items (issues/PRs) in a project with filtering & field values
1270+
- get_project_item: Get a single item by item_id
1271+
1272+
Write tools:
1273+
- add_project_item: Add an issue or PR to a project
1274+
- update_project_item: Update field values for an item (status, priority, etc.)
1275+
- delete_project_item: Remove an item from a project
12621276
12631277
Core rules:
1264-
- list_projects: NEVER include item-level filters.
1265-
- Before filtering on custom fields call list_project_fields.
1266-
- Always paginate until pageInfo.hasNextPage=false.
1267-
- Keep query, fields, per_page identical across pages.
1268-
- Include fields IDs on every list_project_items page if you need values.
1269-
- Prefer explicit is:issue / is:pr unless mixed set requested.
1270-
- Only summarize if verbs like analyze / summarize / report / overview / insights appear; otherwise enumerate.
1278+
- list_projects: NEVER include item-level filters (no is:issue, assignee:, label:, etc.)
1279+
- Before filtering on fields, call list_project_fields to get field IDs
1280+
- Always paginate until pageInfo.hasNextPage=false
1281+
- Keep query, fields, per_page identical across pages
1282+
- Include field IDs on every list_project_items page if you need values
1283+
- Prefer explicit is:issue / is:pr unless mixed set requested
1284+
- Only summarize if verbs like analyze / summarize / report / overview / insights appear; otherwise enumerate
12711285
12721286
Field resolution:
1273-
- Use exact returned field names; don't invent.
1274-
- Iteration synonyms map to actual existing name (Sprint → sprint:@current, etc.). If none exist, omit.
1275-
- Only add filters for fields that exist and matter to the user goal.
1287+
- Use exact returned field names; don't invent
1288+
- Iteration synonyms map to actual existing name (Sprint → sprint:@current, etc.). If none exist, omit
1289+
- Only add filters for fields that exist and matter to the user goal
12761290
12771291
Query syntax essentials:
12781292
AND space | OR comma | NOT prefix - | quote multi-word values | hyphenate names | ranges points:1..5 | comparisons updated:>@today-7d priority:>1 | wildcards title:*crash*
12791293
12801294
Pagination pattern:
1281-
Call list_project_items → if hasNextPage true, repeat with after=nextCursor → stop only when false → then count/deduplicate.
1295+
Call list_project_items → if hasNextPage true, repeat with after=nextCursor → stop only when false → then count/deduplicate
12821296
12831297
Counting:
1284-
- Items array length after full pagination (dedupe by item.id or node_id).
1285-
- Never count fields array, content, assignees, labels as separate items.
1286-
- item.id = project item identifier; content.id = underlying issue/PR id.
1298+
- Items array length after full pagination (dedupe by item.id or node_id)
1299+
- Never count fields array, content, assignees, labels as separate items
1300+
- item.id = project item identifier; content.id = underlying issue/PR id
12871301
12881302
Edge handling:
1289-
Empty pages → total=0 still return pageInfo.
1290-
Duplicates → keep first for totals.
1291-
Missing field values → null/omit, never fabricate.
1303+
Empty pages → total=0 still return pageInfo
1304+
Duplicates → keep first for totals
1305+
Missing field values → null/omit, never fabricate
12921306
12931307
Self-check: paginated? deduped? correct IDs? field names valid? summary allowed?`),
12941308
},
@@ -1306,22 +1320,23 @@ Self-check: paginated? deduped? correct IDs? field names valid? summary allowed?
13061320
},
13071321
{
13081322
Role: "assistant",
1309-
Content: mcp.NewTextContent("Start by listing projects: project_read method=\"list_projects\"."),
1323+
Content: mcp.NewTextContent("Start by listing projects: use list_projects tool with owner and owner_type parameters."),
13101324
},
13111325
{
13121326
Role: "user",
13131327
Content: mcp.NewTextContent("How do I work with fields and items?"),
13141328
},
13151329
{
13161330
Role: "assistant",
1317-
Content: mcp.NewTextContent(`Fields & items:
1318-
1. list_project_fields first → map lowercased name -> {id,type}.
1319-
2. Use only existing field names; no invention.
1320-
3. Iteration mapping: pick sprint/cycle/iteration only if present (sprint:@current etc.).
1321-
4. Include only relevant fields (e.g. Priority + Label for high priority bugs).
1322-
5. Build query after resolving fields ("last week" → updated:>@today-7d).
1323-
6. Paginate until hasNextPage=false; keep query/fields/per_page stable.
1324-
7. Include fields IDs every page when you need their values.
1331+
Content: mcp.NewTextContent(`Fields & items workflow:
1332+
1. Call list_project_fields to get field definitions → map lowercased name -> {id,type}
1333+
2. Use only existing field names; no invention
1334+
3. Iteration mapping: pick sprint/cycle/iteration only if present (sprint:@current etc.)
1335+
4. Include only relevant fields (e.g. Priority + Label for high priority bugs)
1336+
5. Build query after resolving fields ("last week" → updated:>@today-7d)
1337+
6. Call list_project_items with query and field IDs → paginate until hasNextPage=false
1338+
7. Keep query/fields/per_page stable across all pages
1339+
8. Include field IDs on every page when you need their values
13251340
Missing field? Omit or clarify—never guess.`),
13261341
},
13271342
{
@@ -1330,58 +1345,90 @@ Missing field? Omit or clarify—never guess.`),
13301345
},
13311346
{
13321347
Role: "assistant",
1333-
Content: mcp.NewTextContent(`Updating fields (project_write update_project_item):
1334-
Examples: text {"id":123,"value":"hello"} | select {"id":456,"value":789} (option ID) | number {"id":321,"value":5} | date {"id":654,"value":"2025-03-15"} | clear {"id":123,"value":null}
1335-
Rules: item_id = project item wrapper ID; confirm field IDs via list_project_fields; select/iteration = pass option/iteration ID (not name).`),
1348+
Content: mcp.NewTextContent(`Updating fields (update_project_item tool):
1349+
Input format: updated_field parameter with {id: <field_id>, value: <new_value>}
1350+
Examples:
1351+
- Text field: {"id":123,"value":"hello"}
1352+
- Single-select: {"id":456,"value":789} (value is option ID, not name)
1353+
- Number: {"id":321,"value":5}
1354+
- Date: {"id":654,"value":"2025-03-15"}
1355+
- Clear field: {"id":123,"value":null}
1356+
1357+
Rules:
1358+
- item_id parameter = project item ID (from list_project_items), NOT issue/PR ID
1359+
- Get field IDs from list_project_fields first
1360+
- For select/iteration fields, pass option/iteration ID as value, not the name
1361+
- To add an item first: use add_project_item tool with issue/PR ID
1362+
- To remove an item: use delete_project_item tool`),
13361363
},
13371364
{
13381365
Role: "user",
13391366
Content: mcp.NewTextContent("Show me a workflow example."),
13401367
},
13411368
{
13421369
Role: "assistant",
1343-
Content: mcp.NewTextContent(`Workflow quick path:
1344-
1 list_projects → pick project_number.
1345-
2 list_project_fields → build field map.
1346-
3 Build query (e.g. is:issue sprint:@current priority:high updated:>@today-7d).
1347-
4 list_project_items (include field IDs) → paginate fully.
1348-
5 Optional deep dive: issue_read / pull_request_read per item.
1349-
6 Optional update: project_write update_project_item.
1350-
Reminders: iteration filter must match existing field; keep fields consistent; summarize only if asked.`),
1370+
Content: mcp.NewTextContent(`Workflow example:
1371+
1. list_projects → pick project_number
1372+
2. list_project_fields → build field map {name: {id, type}}
1373+
3. Build query (e.g. is:issue sprint:@current priority:high updated:>@today-7d)
1374+
4. list_project_items with field IDs → paginate fully (loop until hasNextPage=false)
1375+
5. Optional: get_project_item for specific item details
1376+
6. Optional: add_project_item to add issue/PR to project
1377+
7. Optional: update_project_item to change field values for an item
1378+
8. Optional: delete_project_item to remove from an item from project
1379+
1380+
Important:
1381+
- Iteration filter must match existing field name
1382+
- Keep fields parameter consistent across pages
1383+
- Summarize only if explicitly asked
1384+
- item_id for updates/deletes comes from list_project_items response
1385+
- content.id in items is the underlying issue/PR ID (use with add_project_item)`),
13511386
},
13521387
{
13531388
Role: "user",
13541389
Content: mcp.NewTextContent("How do I handle pagination?"),
13551390
},
13561391
{
13571392
Role: "assistant",
1358-
Content: mcp.NewTextContent(`Pagination:
1359-
Loop while hasNextPage=true using after=nextCursor.
1360-
Do NOT change query/fields/per_page.
1361-
Include same fields IDs every page.
1362-
Only count/summarize after final page.`),
1393+
Content: mcp.NewTextContent(`Pagination with list_project_items:
1394+
1. Make initial call with query, fields, per_page parameters
1395+
2. Check response pageInfo.hasNextPage
1396+
3. If true: call again with same query/fields/per_page + after=pageInfo.nextCursor
1397+
4. Repeat step 2-3 until hasNextPage=false
1398+
5. Collect all items from all pages before counting/analyzing
1399+
1400+
Critical: Do NOT change query, fields, or per_page between pages. Always include same field IDs on every page if you need field values.`),
13631401
},
13641402
{
13651403
Role: "user",
13661404
Content: mcp.NewTextContent("How do I get more details about items?"),
13671405
},
13681406
{
13691407
Role: "assistant",
1370-
Content: mcp.NewTextContent(`Deep details:
1371-
Use issue_read or pull_request_read for comments/reviews/diffs after enumeration.
1372-
Inputs: repository + item content.number.
1373-
Confirm type (is:issue vs is:pr) before choosing which tool.`),
1408+
Content: mcp.NewTextContent(`Getting additional item details:
1409+
1410+
- First inspect item's content object for info, e.g. title, assignees, labels
1411+
- If additional detail is needed, and relevant fields are present from list_project_fields, include their IDs in list_project_items and request with list_project_items again.
1412+
- If more detail needed, use separate issue/PR tools`),
13741413
},
13751414
{
13761415
Role: "assistant",
1377-
Content: mcp.NewTextContent(`Query patterns:
1378-
blocked issues → is:issue (label:blocked OR status:"Blocked")
1379-
overdue tasks → is:issue due-date:<@today state:open
1380-
PRs ready for review → is:pr review-status:"Ready for Review" state:open
1381-
stale issues → is:issue updated:<@today-30d state:open
1382-
high priority bugs → is:issue label:bug priority:high state:open
1383-
team sprint PRs → is:pr team-name:"Backend Team" sprint:@current
1384-
Rules: summarize only if asked; dedupe before counts; quote multi-word values; never invent field names or IDs.`),
1416+
Content: mcp.NewTextContent(`Query patterns for list_project_items:
1417+
1418+
Common scenarios:
1419+
- Blocked issues: is:issue (label:blocked OR status:"Blocked")
1420+
- Overdue tasks: is:issue due-date:<@today state:open
1421+
- PRs ready for review: is:pr review-status:"Ready for Review" state:open
1422+
- Stale issues: is:issue updated:<@today-30d state:open
1423+
- High priority bugs: is:issue label:bug priority:high state:open
1424+
- Team sprint PRs: is:pr team-name:"Backend Team" sprint:@current
1425+
1426+
Rules:
1427+
- Summarize only if user requests it with verbs like "analyze", "summarize", "report"
1428+
- Deduplicate by item.id before counting totals
1429+
- Quote multi-word values: status:"In Progress"
1430+
- Never invent field names or IDs - always verify with list_project_fields first
1431+
- Use explicit is:issue or is:pr unless user wants mixed items`),
13851432
},
13861433
}
13871434
return &mcp.GetPromptResult{

0 commit comments

Comments
 (0)