Skip to main content
Glama

list_issues

Retrieve issues from a GitHub repository with filters for state, labels, sort order, and date. Use to find open, closed, or all issues.

Instructions

List issues in a GitHub repository.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner
repoYesRepository name
stateNoFilter by state
labelsNoFilter by labels
sortNoSort order
directionNoSort direction
sinceNoFilter by date (ISO 8601 timestamp)
per_pageNoResults per page (default 10, max 100)
pageNoPage number (default 1)

Implementation Reference

  • Handler function for the 'list_issues' tool. Calls octokit.rest.issues.listForRepo with params (owner, repo, state, labels, sort, direction, since, per_page, page), filters out pull requests, and formats results as markdown.
    // Tool: List Issues
    server.tool(
    	"list_issues",
    	"List issues in a GitHub repository.",
    	{
    		owner: z.string().describe("Repository owner"),
    		repo: z.string().describe("Repository name"),
    		state: z
    			.enum(["open", "closed", "all"])
    			.optional()
    			.describe("Filter by state"),
    		labels: z.array(z.string()).optional().describe("Filter by labels"),
    		sort: z
    			.enum(["created", "updated", "comments"])
    			.optional()
    			.describe("Sort order"),
    		direction: z.enum(["asc", "desc"]).optional().describe("Sort direction"),
    		since: z
    			.string()
    			.optional()
    			.describe("Filter by date (ISO 8601 timestamp)"),
    		per_page: z
    			.number()
    			.optional()
    			.default(10)
    			.describe("Results per page (default 10, max 100)"),
    		page: z
    			.number()
    			.optional()
    			.default(1)
    			.describe("Page number (default 1)"),
    	},
    	async ({
    		owner,
    		repo,
    		state,
    		labels,
    		sort,
    		direction,
    		since,
    		per_page,
    		page,
    	}) => {
    		try {
    			const response = await octokit.rest.issues.listForRepo({
    				owner,
    				repo,
    				state,
    				labels: labels ? labels.join(",") : undefined,
    				sort,
    				direction,
    				since,
    				per_page,
    				page,
    			})
    
    			// Format the response as clean markdown
    			const issues = response.data.filter(item => !item.pull_request) // Filter out PRs
    
    			if (issues.length === 0) {
    				return {
    					content: [{ type: "text", text: "No issues found." }],
    				}
    			}
    
    			let markdown = `# Issues for ${owner}/${repo}\n\n`
    			markdown += `Showing ${issues.length} issue(s) - Page ${page}\n`
    			if (response.data.length === per_page) {
    				markdown += `*Note: More results may be available. Use 'page' parameter to see next page.*\n`
    			}
    			markdown += `\n`
    
    			issues.forEach(issue => {
    				markdown += `## #${issue.number}: ${issue.title}\n\n`
    				markdown += `- **State**: ${issue.state}\n`
    				markdown += `- **Author**: ${issue.user?.login || "Unknown"}\n`
    				markdown += `- **Created**: ${new Date(issue.created_at).toLocaleDateString()}\n`
    				markdown += `- **Updated**: ${new Date(issue.updated_at).toLocaleDateString()}\n`
    
    				if (issue.labels && issue.labels.length > 0) {
    					markdown += `- **Labels**: ${issue.labels.map(l => (typeof l === "string" ? l : l.name)).join(", ")}\n`
    				}
    
    				if (issue.assignees && issue.assignees.length > 0) {
    					markdown += `- **Assignees**: ${issue.assignees.map(a => a.login).join(", ")}\n`
    				}
    
    				if (issue.milestone) {
    					markdown += `- **Milestone**: ${issue.milestone.title}\n`
    				}
    
    				markdown += `- **Comments**: ${issue.comments}\n`
    				markdown += `- **URL**: ${issue.html_url}\n`
    				markdown += `\n`
    			})
    
    			return {
    				content: [{ type: "text", text: markdown }],
    			}
    		} catch (e: any) {
    			return {
    				content: [{ type: "text", text: `Error: ${e.message}` }],
    			}
    		}
    	},
    )
  • Input schema for 'list_issues' tool: owner, repo, state (open/closed/all), labels (array), sort (created/updated/comments), direction (asc/desc), since (ISO date string), per_page (default 10), page (default 1).
    {
    	owner: z.string().describe("Repository owner"),
    	repo: z.string().describe("Repository name"),
    	state: z
    		.enum(["open", "closed", "all"])
    		.optional()
    		.describe("Filter by state"),
    	labels: z.array(z.string()).optional().describe("Filter by labels"),
    	sort: z
    		.enum(["created", "updated", "comments"])
    		.optional()
    		.describe("Sort order"),
    	direction: z.enum(["asc", "desc"]).optional().describe("Sort direction"),
    	since: z
    		.string()
    		.optional()
    		.describe("Filter by date (ISO 8601 timestamp)"),
    	per_page: z
    		.number()
    		.optional()
    		.default(10)
    		.describe("Results per page (default 10, max 100)"),
    	page: z
    		.number()
    		.optional()
    		.default(1)
    		.describe("Page number (default 1)"),
    },
  • Registration of 'list_issues' tool via server.tool('list_issues', ...) inside registerIssueTools.
    server.tool(
    	"list_issues",
    	"List issues in a GitHub repository.",
    	{
    		owner: z.string().describe("Repository owner"),
    		repo: z.string().describe("Repository name"),
    		state: z
    			.enum(["open", "closed", "all"])
    			.optional()
    			.describe("Filter by state"),
    		labels: z.array(z.string()).optional().describe("Filter by labels"),
    		sort: z
    			.enum(["created", "updated", "comments"])
    			.optional()
    			.describe("Sort order"),
    		direction: z.enum(["asc", "desc"]).optional().describe("Sort direction"),
    		since: z
    			.string()
    			.optional()
    			.describe("Filter by date (ISO 8601 timestamp)"),
    		per_page: z
    			.number()
    			.optional()
    			.default(10)
    			.describe("Results per page (default 10, max 100)"),
    		page: z
    			.number()
    			.optional()
    			.default(1)
    			.describe("Page number (default 1)"),
    	},
    	async ({
    		owner,
    		repo,
    		state,
    		labels,
    		sort,
    		direction,
    		since,
    		per_page,
    		page,
    	}) => {
    		try {
    			const response = await octokit.rest.issues.listForRepo({
    				owner,
    				repo,
    				state,
    				labels: labels ? labels.join(",") : undefined,
    				sort,
    				direction,
    				since,
    				per_page,
    				page,
    			})
    
    			// Format the response as clean markdown
    			const issues = response.data.filter(item => !item.pull_request) // Filter out PRs
    
    			if (issues.length === 0) {
    				return {
    					content: [{ type: "text", text: "No issues found." }],
    				}
    			}
    
    			let markdown = `# Issues for ${owner}/${repo}\n\n`
    			markdown += `Showing ${issues.length} issue(s) - Page ${page}\n`
    			if (response.data.length === per_page) {
    				markdown += `*Note: More results may be available. Use 'page' parameter to see next page.*\n`
    			}
    			markdown += `\n`
    
    			issues.forEach(issue => {
    				markdown += `## #${issue.number}: ${issue.title}\n\n`
    				markdown += `- **State**: ${issue.state}\n`
    				markdown += `- **Author**: ${issue.user?.login || "Unknown"}\n`
    				markdown += `- **Created**: ${new Date(issue.created_at).toLocaleDateString()}\n`
    				markdown += `- **Updated**: ${new Date(issue.updated_at).toLocaleDateString()}\n`
    
    				if (issue.labels && issue.labels.length > 0) {
    					markdown += `- **Labels**: ${issue.labels.map(l => (typeof l === "string" ? l : l.name)).join(", ")}\n`
    				}
    
    				if (issue.assignees && issue.assignees.length > 0) {
    					markdown += `- **Assignees**: ${issue.assignees.map(a => a.login).join(", ")}\n`
    				}
    
    				if (issue.milestone) {
    					markdown += `- **Milestone**: ${issue.milestone.title}\n`
    				}
    
    				markdown += `- **Comments**: ${issue.comments}\n`
    				markdown += `- **URL**: ${issue.html_url}\n`
    				markdown += `\n`
    			})
    
    			return {
    				content: [{ type: "text", text: markdown }],
    			}
    		} catch (e: any) {
    			return {
    				content: [{ type: "text", text: `Error: ${e.message}` }],
    			}
    		}
    	},
    )
  • The registerIssueTools function that wraps all issue tool registrations.
    export function registerIssueTools(server: McpServer, octokit: Octokit) {
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must carry the full burden. It only states 'List issues' implying a read operation, but omits important behaviors like pagination, default sorting, and response structure. The agent is left to infer these from the schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely short (one sentence), which is concise but lacks structure to quickly guide the agent. It does not front-load key information like default pagination or filtering capabilities.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's 9 parameters, no output schema, and no annotations, the description is insufficient. It does not explain pagination behavior, sort defaults, or return value structure, leaving the agent with significant gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The description adds no extra meaning beyond the schema, but the schema itself is adequately self-descriptive for each parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action (list) and resource (issues) with a specific context (GitHub repository). However, it does not differentiate from sibling tools like list_pull_requests or search_issues, which could lead to confusion.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as search_issues or get_issue. The agent receives no context about selection criteria.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hithereiamaliff/mcp-github'

If you have feedback or need assistance with the MCP directory API, please join our Discord server