get_project_count
Retrieve the total number of projects managed by the MCP Project Query Server to monitor project inventory and track system usage.
Instructions
获取项目总数
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_project_count"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/main/index.ts:45-52 (registration)Registers the MCP tool 'get_project_count' with empty input schema and a handler that delegates to ProjectController.getProjectCount().
server.tool( 'get_project_count', '获取项目总数', {}, async () => { return projectController.getProjectCount(); } ); - The main handler function for the tool, retrieves project count from service and formats it as an MCP response with text content.
getProjectCount(): { content: Array<{ type: "text"; text: string }> } { const count = this.projectService.getProjectCount(); return { content: [ { type: 'text', text: `项目总数: ${count}`, }, ], }; } - Helper method in ProjectService that delegates the project count retrieval to the repository.
getProjectCount(): number { return this.projectRepository.getProjectCount(); } - Core implementation in ProjectRepository that returns the length of the in-memory projects array.
getProjectCount(): number { return this.projects.length; }