Skip to main content
Glama

list_projects

Retrieve GitHub Projects V2 for a specified organization or user to view project details and manage workflows.

Instructions

List GitHub Projects V2 for a given organization or user.

Args:
    owner: The GitHub organization or user name

Returns:
    A formatted string with project details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYes

Implementation Reference

  • The handler function for the 'list_projects' tool, decorated with @mcp.tool() for registration. It fetches projects using the GitHubClient helper and formats the results as a string.
    @mcp.tool()
    async def list_projects(owner: str) -> str:
        """List GitHub Projects V2 for a given organization or user.
    
        Args:
            owner: The GitHub organization or user name
    
        Returns:
            A formatted string with project details
        """
        try:
            projects = await github_client.get_projects(owner)
    
            if not projects:
                return f"No projects found for {owner}"
    
            result = f"Projects for {owner}:\n\n"
            for project in projects:
                result += f"- ID: {project['id']}\n"
                result += f"  Number: {project['number']}\n"
                result += f"  Title: {project['title']}\n"
                result += f"  URL: {project['url']}\n"
                result += "\n"
    
            return result
        except GitHubClientError as e:
            logger.error(f"Error listing projects for {owner}: {e}")
            return f"Error: Could not list projects for {owner}. Details: {e}"
  • The helper method in GitHubClient class that implements the core logic for retrieving GitHub Projects V2 via GraphQL queries, distinguishing between organization and user owners.
    async def get_projects(self, owner: str) -> List[Dict[str, Any]]:
        """Get Projects V2 for an organization or user.
    
        Args:
            owner: The GitHub organization or user name
    
        Returns:
            List of projects
    
        Raises:
            GitHubClientError: If the owner is not found or projects cannot be retrieved.
        """
        # First determine if this is a user or organization
        query = """
        query GetOwnerType($login: String!) {
          organization(login: $login) {
            id
            login
            __typename
          }
          user(login: $login) {
            id
            login
            __typename
          }
        }
        """
    
        variables = {"login": owner}
    
        try:
            result = await self.execute_query(query, variables)
        except GitHubClientError as e:
            logger.error(f"Failed to determine owner type for {owner}: {e}")
            raise  # Re-raise the error
    
        # Determine if the owner is a user or organization
        owner_type = None
        owner_id = None
    
        if result.get("organization"):
            owner_type = "organization"
            owner_id = result["organization"]["id"]
        elif result.get("user"):
            owner_type = "user"
            owner_id = result["user"]["id"]
        else:
            error_message = f"Owner {owner} not found or type could not be determined."
            logger.error(error_message)
            raise GitHubClientError(error_message)
    
        # Now get the projects based on owner type
        if owner_type == "organization":
            query = """
            query GetOrgProjects($login: String!, $first: Int!) {
              organization(login: $login) {
                projectsV2(first: $first) {
                  nodes {
                    id
                    number
                    title
                    shortDescription
                    url
                    closed
                    public
                  }
                }
              }
            }
            """
    
            variables = {"login": owner, "first": 50}
    
            try:
                result = await self.execute_query(query, variables)
                if not result.get("organization") or not result["organization"].get(
                    "projectsV2"
                ):
                    raise GitHubClientError(
                        f"Could not retrieve projects for organization {owner}"
                    )
                return result["organization"]["projectsV2"]["nodes"]
            except GitHubClientError as e:
                logger.error(f"Failed to get projects for organization {owner}: {e}")
                raise
    
        elif owner_type == "user":
            query = """
            query GetUserProjects($login: String!, $first: Int!) {
              user(login: $login) {
                projectsV2(first: $first) {
                  nodes {
                    id
                    number
                    title
                    shortDescription
                    url
                    closed
                    public
                  }
                }
              }
            }
            """
    
            variables = {"login": owner, "first": 50}
    
            try:
                result = await self.execute_query(query, variables)
                if not result.get("user") or not result["user"].get("projectsV2"):
                    raise GitHubClientError(
                        f"Could not retrieve projects for user {owner}"
                    )
                return result["user"]["projectsV2"]["nodes"]
            except GitHubClientError as e:
                logger.error(f"Failed to get projects for user {owner}: {e}")
                raise
    
        # This part should be unreachable if owner_type is determined correctly
        raise GitHubClientError(f"Unexpected error retrieving projects for {owner}")
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool lists projects and returns a formatted string, but it doesn't cover critical aspects like authentication requirements, rate limits, pagination behavior, error handling, or whether it's read-only or has side effects. For a tool with no annotations, this leaves significant gaps in understanding its operational traits.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, starting with the core purpose in the first sentence. The 'Args' and 'Returns' sections are structured but could be more integrated; overall, it's efficient with minimal waste, though it could be slightly more polished in flow.

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

Completeness3/5

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

Given the tool's low complexity (one parameter, no output schema, no annotations), the description is somewhat complete but lacks depth. It covers the basic purpose and parameter semantics but misses behavioral details and usage guidelines. For a simple list tool, this is adequate but not comprehensive, aligning with a minimum viable score.

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?

The description adds some meaning beyond the input schema by explaining that 'owner' refers to 'The GitHub organization or user name,' which clarifies the parameter's purpose. However, with 0% schema description coverage and only one parameter, the baseline is 4, but the description doesn't fully compensate by providing details like format examples or constraints, so it scores slightly lower at 3.

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 tool's purpose: 'List GitHub Projects V2 for a given organization or user.' It specifies the verb ('List'), resource ('GitHub Projects V2'), and scope ('organization or user'), which is specific and actionable. However, it doesn't explicitly differentiate from sibling tools like 'get_project_items' or 'get_project_fields', which might have overlapping functionality, so it doesn't reach a perfect score of 5.

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?

The description provides no guidance on when to use this tool versus alternatives. It mentions the 'owner' parameter but doesn't clarify scenarios where this tool is preferred over siblings like 'get_project_items' or 'get_project_fields', nor does it mention prerequisites or exclusions. This lack of contextual usage advice limits its effectiveness for an AI agent.

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/Arclio/github-projects-mcp'

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