searchIssues
Find and track issues and discussions in private GitHub repositories using GitHub Issue Search syntax. Streamline task management and collaborative project workflows with accurate results.
Instructions
Search for issues and discussions in your Obsidian vault repository (johndoe-org/obsidian-vault). Great for tracking tasks, project management, and collaborative knowledge work.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query (uses GitHub Issue Search syntax) |
Implementation Reference
- src/github/client.ts:612-633 (handler)Handler function that performs the searchIssues tool logic: constructs a GitHub search query for issues in the specified repo, calls the Octokit API to search issues and pull requests, formats the results as a markdown list, and returns them as text content.async ({ query }) => { const repoQualifier = `repo:${this.config.owner}/${this.config.repo}`; const qualifiedQuery = `${query} is:issue ${repoQualifier}`; const searchResults = await this.handleRequest(async () => { return this.octokit.search.issuesAndPullRequests({ q: qualifiedQuery, }); }); // Format results as a markdown list const formattedResults = searchResults.items .map((item) => `- #${item.number} ${item.title} (${item.html_url})`) .join("\n"); return { // Return formatted text instead of raw JSON string content: [ { type: "text" as const, text: `Found ${searchResults.total_count} issues:\n${formattedResults}`, }, ], }; }
- src/github/client.ts:602-604 (schema)Zod schema defining the input parameter 'query' for the searchIssues tool.query: z .string() .describe("Search query (uses GitHub Issue Search syntax)"),
- src/github/client.ts:598-634 (registration)Full registration of the 'searchIssues' tool using server.tool(), including tool name, description, input schema, execution hints, and the handler function.server.tool( "searchIssues", `Search for issues and discussions in your Obsidian vault repository (${this.config.owner}/${this.config.repo}). Great for tracking tasks, project management, and collaborative knowledge work.`, { query: z .string() .describe("Search query (uses GitHub Issue Search syntax)"), }, { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true, }, async ({ query }) => { const repoQualifier = `repo:${this.config.owner}/${this.config.repo}`; const qualifiedQuery = `${query} is:issue ${repoQualifier}`; const searchResults = await this.handleRequest(async () => { return this.octokit.search.issuesAndPullRequests({ q: qualifiedQuery, }); }); // Format results as a markdown list const formattedResults = searchResults.items .map((item) => `- #${item.number} ${item.title} (${item.html_url})`) .join("\n"); return { // Return formatted text instead of raw JSON string content: [ { type: "text" as const, text: `Found ${searchResults.total_count} issues:\n${formattedResults}`, }, ], }; } );