get_projects
Retrieve active project lists from Mantis Bug Tracker to streamline project tracking and management within the Mantis MCP Server environment.
Instructions
獲取 Mantis 專案列表
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_projects"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:187-197 (registration)Registration of the 'get_projects' MCP tool, including name, description, empty input schema, and inline handler function.
server.tool( "get_projects", "獲取 Mantis 專案列表", {}, async () => { return withMantisConfigured("get_projects", async () => { const projects = await mantisApi.getProjects(); return JSON.stringify(projects, null, 2); }); } ); - src/services/mantisApi.ts:277-285 (handler)Core handler logic in MantisApi class that fetches the list of projects from the Mantis API endpoint '/projects' using cached request.
async getProjects(): Promise<Project[]> { log.info('獲取項目列表'); const cacheKey = 'projects'; return this.cachedRequest<Project[]>(cacheKey, () => { return this.api.get('/projects'); }); } - src/services/mantisApi.ts:68-77 (schema)TypeScript interface defining the Project type returned by getProjects.
export interface Project { id: number; name: string; description: string; enabled: boolean; status: { id: number; name: string; }; } - src/server.ts:191-196 (helper)Wrapper handler in server.tool that handles MCP response formatting, error handling via withMantisConfigured, and JSON serialization.
async () => { return withMantisConfigured("get_projects", async () => { const projects = await mantisApi.getProjects(); return JSON.stringify(projects, null, 2); }); }