Skip to main content
Glama

jira_list_projects

Retrieve all accessible Jira projects by providing authentication details to view and manage project lists.

Instructions

Lists all Jira projects the user has access to

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jiraHostNoThe Jira host URL (e.g., 'your-domain.atlassian.net')
emailNoEmail address associated with the Jira account
apiTokenNoAPI token for Jira authentication

Implementation Reference

  • The main handler function that executes the tool logic: validates credentials, calls Jira API to list projects, formats as Markdown table, handles errors.
    export async function listProjects(args: any) {
        const validatedArgs = await JiraApiRequestSchema.validate(args);
    
        const jiraHost = validatedArgs.jiraHost || process.env.JIRA_HOST;
        const email = validatedArgs.email || process.env.JIRA_EMAIL;
        const apiToken = validatedArgs.apiToken || process.env.JIRA_API_TOKEN;
    
        if (!jiraHost || !email || !apiToken) {
            throw new Error('Missing required authentication credentials. Please provide jiraHost, email, and apiToken.');
        }
    
        validateCredentials(jiraHost, email, apiToken);
    
        const authHeader = createAuthHeader(email, apiToken);
    
        try {
            const response = await axios.get(`https://${jiraHost}/rest/api/3/project`, {
                headers: {
                    'Authorization': authHeader,
                    'Accept': 'application/json',
                },
            });
    
            const projects = response.data;
    
            let formattedResponse = `# Jira Projects\n\n`;
            formattedResponse += `Total projects: ${projects.length}\n\n`;
    
            if (Array.isArray(projects) && projects.length > 0) {
                formattedResponse += `| Project Key | Name | Type | Lead |\n`;
                formattedResponse += `|------------|------|------|------|\n`;
    
                projects.forEach((project: any) => {
                    formattedResponse += `| ${project.key} | ${project.name} | ${project.projectTypeKey || 'N/A'} | ${project.lead?.displayName || 'Unknown'} |\n`;
                });
            } else {
                formattedResponse += "No projects found or you don't have access to any projects.";
            }
    
            return {
                content: [{ type: "text", text: formattedResponse }],
                isError: false,
            };
        } catch (error: any) {
            let errorMsg = "An error occurred while listing projects.";
    
            if (error.response) {
                errorMsg = `Error ${error.response.status}: ${error.response.data?.errorMessages?.join(', ') || error.message}`;
            } else if (error.message) {
                errorMsg = error.message;
            }
    
            return {
                content: [{ type: "text", text: `# Error\n\n${errorMsg}` }],
                isError: true,
            };
        }
    }
  • Yup validation schema for basic Jira API requests (jiraHost, email, apiToken), used to validate inputs for jira_list_projects.
    export const JiraApiRequestSchema = yup.object({
        jiraHost: yup.string()
            .default(process.env.JIRA_HOST || "")
            .test(
                'check-jira-host',
                'Jira host is required and must be a valid domain (e.g., "company.atlassian.net")',
                (value) => !!value && value.trim().length > 0
            ),
        email: yup.string()
            .email('Invalid email format. Please provide a valid email associated with your Jira account')
            .default(process.env.JIRA_EMAIL || "")
            .test(
                'check-email',
                'Email is required for Jira authentication',
                (value) => !!value && value.trim().length > 0
            ),
        apiToken: yup.string()
            .default(process.env.JIRA_API_TOKEN || "")
            .test(
                'check-api-token',
                'API token is required for Jira authentication',
                (value) => !!value && value.trim().length > 0
            ),
    });
  • Registration of the jira_list_projects tool in the toolConfigs mapping, linking schema and handler for execution in handleCallTool.
    jira_list_projects: {
        schema: JiraApiRequestSchema,
        handler: listProjects
    },
  • Tool description registration in handleListTools response, providing name, description, and input schema for MCP tool listing.
    {
        name: "jira_list_projects",
        description: "Lists all Jira projects the user has access to",
        inputSchema: {
            type: "object",
            properties: {
                ...getCommonJiraProperties(),
            },
            required: [],
        },
    },
  • Tool description object exported from the tool file, including name, description, and inline input schema.
    export const listProjectsToolDescription = {
        name: "jira_list_projects",
        description: "Lists all Jira projects the user has access to",
        inputSchema: {
            type: "object",
            properties: {
                jiraHost: {
                    type: "string",
                    description: "The Jira host URL (e.g., 'your-domain.atlassian.net')",
                    default: process.env.JIRA_HOST || "",
                },
                email: {
                    type: "string",
                    description: "Email address associated with the Jira account",
                    default: process.env.JIRA_EMAIL || "",
                },
                apiToken: {
                    type: "string",
                    description: "API token for Jira authentication",
                    default: process.env.JIRA_API_TOKEN || "",
                },
            },
            required: [],
        },
    };
Behavior2/5

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

With no annotations, the description carries full burden but provides minimal behavioral context. It doesn't disclose whether this is a read-only operation (implied by 'Lists'), authentication requirements beyond the parameters, rate limits, pagination behavior, or what the output format looks like. For a tool with authentication parameters, this is inadequate.

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 appropriately sized for a simple list operation and front-loads the core purpose immediately.

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 has authentication parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain how authentication works, what the return data includes, or any behavioral constraints. For a tool interacting with an external API like Jira, this leaves 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 the schema fully documents all three parameters. The description adds no additional parameter semantics beyond what's in the schema. The baseline score of 3 reflects adequate coverage through the schema alone.

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 ('Lists') and resource ('all Jira projects'), specifying scope with 'the user has access to'. It distinguishes from siblings like 'jira_list_project_members' by focusing on projects rather than members, but doesn't explicitly differentiate from other list tools like 'jira_list_sprints' beyond the resource name.

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 on when to use this tool versus alternatives is provided. The description doesn't mention prerequisites like authentication setup, nor does it suggest when to use this versus 'jira_search_issues' for project-related queries. Usage context is implied but not explicit.

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/samuelrizzo/jira-mcp-server'

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