get_project_stats
Retrieve statistics for a WebSim project to analyze performance metrics and usage data.
Instructions
Get statistics for a WebSim project
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | WebSim project ID |
Input Schema (JSON Schema)
{
"properties": {
"project_id": {
"description": "WebSim project ID",
"type": "string"
}
},
"required": [
"project_id"
],
"type": "object"
}
Implementation Reference
- server.js:421-434 (handler)The handler function for the 'get_project_stats' tool. It validates input using ProjectIdSchema, calls the API client's getProjectStats method, and returns a formatted success response with the stats data.handler: async (args) => { const { project_id } = ProjectIdSchema.parse(args); const result = await apiClient.getProjectStats(project_id); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Successfully retrieved statistics for project ${project_id}` }, null, 2) }] }; }
- server.js:411-420 (schema)Input schema for the 'get_project_stats' tool, defining the required 'project_id' parameter.inputSchema: { type: "object", properties: { project_id: { type: "string", description: "WebSim project ID" } }, required: ["project_id"] },
- server.js:408-435 (registration)Registration of the 'get_project_stats' tool object in the tools array used by the MCP server.{ name: "get_project_stats", description: "Get statistics for a WebSim project", inputSchema: { type: "object", properties: { project_id: { type: "string", description: "WebSim project ID" } }, required: ["project_id"] }, handler: async (args) => { const { project_id } = ProjectIdSchema.parse(args); const result = await apiClient.getProjectStats(project_id); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Successfully retrieved statistics for project ${project_id}` }, null, 2) }] }; } },
- server.js:127-129 (helper)API client helper method that fetches project statistics from the WebSim API endpoint.async getProjectStats(projectId) { return this.makeRequest(`/api/v1/projects/${projectId}/stats`); }
- server.js:23-25 (helper)Zod schema used for input validation in the get_project_stats handler.const ProjectIdSchema = z.object({ project_id: z.string().describe('WebSim project ID') });