list_projects
Retrieve all MantisBT projects available to your API user for bug tracking and management tasks.
Instructions
List all MantisBT projects accessible to the current API user.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/projects.ts:34-44 (handler)The handler function for 'list_projects' that calls the MantisClient to fetch projects and returns the result as text.
async () => { try { const result = await client.get<{ projects: MantisProject[] }>('projects'); return { content: [{ type: 'text', text: JSON.stringify(result.projects ?? result, null, 2) }], }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); return { content: [{ type: 'text', text: errorText(msg) }], isError: true }; } } - src/tools/projects.ts:22-45 (registration)Registration of the 'list_projects' tool in the MCP server.
server.registerTool( 'list_projects', { title: 'List Projects', description: 'List all MantisBT projects accessible to the current API user.', inputSchema: z.object({}), annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, }, }, async () => { try { const result = await client.get<{ projects: MantisProject[] }>('projects'); return { content: [{ type: 'text', text: JSON.stringify(result.projects ?? result, null, 2) }], }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); return { content: [{ type: 'text', text: errorText(msg) }], isError: true }; } } );