SearchIssues creates a tool to search for issues.
(t translations.TranslationHelperFunc)
| 1528 | |
| 1529 | // SearchIssues creates a tool to search for issues. |
| 1530 | func SearchIssues(t translations.TranslationHelperFunc) inventory.ServerTool { |
| 1531 | schema := &jsonschema.Schema{ |
| 1532 | Type: "object", |
| 1533 | Properties: map[string]*jsonschema.Schema{ |
| 1534 | "query": { |
| 1535 | Type: "string", |
| 1536 | Description: "Search query using GitHub issues search syntax", |
| 1537 | }, |
| 1538 | "owner": { |
| 1539 | Type: "string", |
| 1540 | Description: "Optional repository owner. If provided with repo, only issues for this repository are listed.", |
| 1541 | }, |
| 1542 | "repo": { |
| 1543 | Type: "string", |
| 1544 | Description: "Optional repository name. If provided with owner, only issues for this repository are listed.", |
| 1545 | }, |
| 1546 | "sort": { |
| 1547 | Type: "string", |
| 1548 | Description: "Sort field by number of matches of categories, defaults to best match", |
| 1549 | Enum: []any{ |
| 1550 | "comments", |
| 1551 | "reactions", |
| 1552 | "reactions-+1", |
| 1553 | "reactions--1", |
| 1554 | "reactions-smile", |
| 1555 | "reactions-thinking_face", |
| 1556 | "reactions-heart", |
| 1557 | "reactions-tada", |
| 1558 | "interactions", |
| 1559 | "created", |
| 1560 | "updated", |
| 1561 | }, |
| 1562 | }, |
| 1563 | "order": { |
| 1564 | Type: "string", |
| 1565 | Description: "Sort order", |
| 1566 | Enum: []any{"asc", "desc"}, |
| 1567 | }, |
| 1568 | }, |
| 1569 | Required: []string{"query"}, |
| 1570 | } |
| 1571 | WithPagination(schema) |
| 1572 | |
| 1573 | return NewTool( |
| 1574 | ToolsetMetadataIssues, |
| 1575 | mcp.Tool{ |
| 1576 | Name: "search_issues", |
| 1577 | Description: t("TOOL_SEARCH_ISSUES_DESCRIPTION", "Search for issues in GitHub repositories using issues search syntax already scoped to is:issue"), |
| 1578 | Annotations: &mcp.ToolAnnotations{ |
| 1579 | Title: t("TOOL_SEARCH_ISSUES_USER_TITLE", "Search issues"), |
| 1580 | ReadOnlyHint: true, |
| 1581 | }, |
| 1582 | InputSchema: schema, |
| 1583 | }, |
| 1584 | []scopes.Scope{scopes.Repo}, |
| 1585 | func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { |
| 1586 | result, err := searchIssuesHandler(ctx, deps, args, ifcSearchPostProcessOption(ctx, deps)) |
| 1587 | return result, nil, err |