List Projects
list_projectsRetrieve all MantisBT projects available to the current API user for managing bug tracking workflows.
Instructions
List all MantisBT projects accessible to the current API user.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/projects.ts:38-49 (handler)The handler function for the `list_projects` tool that fetches projects from the MantisBT API and returns them as a JSON string.
async () => { try { const result = await client.get<{ projects: MantisProject[] }>('projects'); const projects = (result.projects ?? []).map(normalizeProject); return { content: [{ type: 'text', text: JSON.stringify(projects, 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:26-50 (registration)Registration of the `list_projects` tool within the MCP server using `server.registerTool`.
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'); const projects = (result.projects ?? []).map(normalizeProject); return { content: [{ type: 'text', text: JSON.stringify(projects, null, 2) }], }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); return { content: [{ type: 'text', text: errorText(msg) }], isError: true }; } } );