Skip to main content
Glama

list_projects

Retrieve a specified number of Jira projects using the REST API endpoint /rest/api/3/project. Ideal for managing and organizing project data efficiently.

Instructions

List all the projects on Jira on the api /rest/api/3/project. Do not use markdown in your query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
number_of_resultsNoNumber of results to return

Implementation Reference

  • Core handler function that executes the tool logic by fetching projects from the Jira API endpoint /rest/api/3/project with the specified maxResults parameter.
    async function listProjects(number_of_results: number): Promise<any> { try { const params = { maxResults: number_of_results, // Adjust as needed }; const response = await axios.get(`${JIRA_URL}/rest/api/3/project`, { headers: getAuthHeaders().headers, params, }); return response.data; } catch (error: any) { //return the error in a json return { error: error.response.data, }; } }
  • Tool dispatch handler within the CallToolRequestSchema that extracts input arguments, calls listProjects, and formats the response as MCP content.
    case 'list_projects': { const number_of_results = Number( request.params.arguments?.number_of_results ?? 1, ); const response = await listProjects(number_of_results); return { content: [ { type: 'text', text: JSON.stringify(response, null, 2), }, ], }; }
  • src/index.ts:126-139 (registration)
    Registers the 'list_projects' tool in the ListToolsRequestSchema response, including name, description, and input schema.
    name: 'list_projects', description: 'List all the projects on Jira on the api /rest/api/3/project. Do not use markdown in your query.', inputSchema: { type: 'object', properties: { number_of_results: { type: 'integer', description: 'Number of results to return', default: 1, }, }, }, },
  • Helper function providing authentication headers used by listProjects to authenticate API requests to Jira.
    function getAuthHeaders(): AxiosRequestConfig<any> { const authHeader = `Basic ${Buffer.from( `${JIRA_API_MAIL}:${JIRA_API_KEY}`, ).toString('base64')}`; return { headers: { Authorization: authHeader, 'Content-Type': 'application/json', }, }; }

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/KS-GEN-AI/jira-mcp-server'

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