Skip to main content
Glama

list_project_v2_items

Fetch and display items from a GitHub project V2 using GraphQL API by specifying the project ID, item count, and pagination cursor for efficient navigation.

Instructions

List items in a GitHub project V2 using GraphQL API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
afterNoCursor for pagination
firstNoNumber of items to fetch (max 100)
projectIdYesThe node ID of the project

Implementation Reference

  • The main handler function that executes a GraphQL query to fetch and return the list of items (issues/PRs) in a GitHub ProjectV2, including pagination and field values.
    export async function listProjectV2Items(
      projectId: string,
      first: number = 20,
      after?: string
    ) {
      try {
        const query = `
          query($projectId: ID!, $first: Int!, $after: String) {
            node(id: $projectId) {
              ... on ProjectV2 {
                items(first: $first, after: $after) {
                  pageInfo {
                    hasNextPage
                    endCursor
                  }
                  nodes {
                    id
                    content {
                      ... on Issue {
                        id
                        title
                        number
                        state
                      }
                      ... on PullRequest {
                        id
                        title
                        number
                        state
                      }
                    }
                    fieldValues(first: 20) {
                      nodes {
                        ... on ProjectV2ItemFieldTextValue {
                          field { ... on ProjectV2FieldCommon { name id } }
                          text
                        }
                        ... on ProjectV2ItemFieldDateValue {
                          field { ... on ProjectV2FieldCommon { name id } }
                          date
                        }
                        ... on ProjectV2ItemFieldSingleSelectValue {
                          field { ... on ProjectV2FieldCommon { name id } }
                          name
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        `;
    
        const variables = { projectId, first, after };
        const response = await graphqlRequest(query, variables);
    
        return response.data.node.items;
      } catch (error) {
        if (error instanceof GitHubError) {
          throw error;
        }
    
        throw new GitHubError(
          `Failed to list project v2 items: ${(error as Error).message}`,
          500,
          { error: (error as Error).message }
        );
      }
    }
  • Zod schema defining the input parameters: projectId (required), first (optional number), after (optional cursor).
    export const ListProjectV2ItemsSchema = z.object({
      projectId: z.string().describe("The node ID of the project"),
      first: z.number().optional().describe("Number of items to fetch (max 100)"),
      after: z.string().optional().describe("Cursor for pagination")
    });
  • index.ts:296-298 (registration)
    Tool registration in the list of available tools, specifying name, description, and input schema converted to JSON schema.
    name: "list_project_v2_items",
    description: "List items in a GitHub project V2 using GraphQL API",
    inputSchema: zodToJsonSchema(projectsV2.ListProjectV2ItemsSchema),
  • index.ts:792-802 (registration)
    Dispatcher case in the main switch statement that parses arguments using the schema and delegates to the listProjectV2Items handler function.
    case "list_project_v2_items": {
      const args = projectsV2.ListProjectV2ItemsSchema.parse(request.params.arguments);
      const result = await projectsV2.listProjectV2Items(
        args.projectId,
        args.first,
        args.after
      );
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }
Behavior2/5

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

With no annotations, the description carries the full burden of behavioral disclosure. It mentions the GraphQL API but doesn't describe key behaviors: whether it's read-only, pagination details beyond schema hints, rate limits, authentication needs, or what the output looks like. This is inadequate for a tool with parameters and no output schema.

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

Conciseness5/5

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

The description is a single, efficient sentence with zero waste. It's front-loaded with the core purpose and includes the API method without unnecessary details, making it easy to parse.

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 complexity (3 parameters, no annotations, no output schema), the description is incomplete. It lacks behavioral context (e.g., read-only status, output format), usage guidance, and doesn't compensate for the missing output schema, leaving gaps for an AI agent to understand how to use it effectively.

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 the schema fully documents parameters like 'after' for pagination and 'first' with a max of 100. The description adds no additional meaning beyond the schema, such as explaining how 'projectId' relates to GitHub projects or pagination behavior. Baseline 3 is appropriate as the schema does the heavy lifting.

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 verb ('List') and resource ('items in a GitHub project V2'), specifying the API method ('using GraphQL API'). It distinguishes from siblings like 'list_issues' or 'list_projects' by focusing on project items, though it doesn't explicitly contrast with 'list_project_columns' or 'list_column_cards'.

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. While the description implies it's for listing project items, it doesn't mention when to choose this over other list tools (e.g., 'list_project_columns' for columns) or prerequisites like needing a project ID.

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

Related 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/tuanle96/mcp-github'

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