list_user_projects
Retrieve all projects created by a specific user in WebSim, with options to limit results and paginate through the list.
Instructions
List all projects for a specific user
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user | Yes | Username | |
| limit | No | Number of projects to return (default: 20) | |
| offset | No | Number of projects to skip (default: 0) |
Input Schema (JSON Schema)
{
"properties": {
"limit": {
"default": 20,
"description": "Number of projects to return (default: 20)",
"type": "number"
},
"offset": {
"default": 0,
"description": "Number of projects to skip (default: 0)",
"type": "number"
},
"user": {
"description": "Username",
"type": "string"
}
},
"required": [
"user"
],
"type": "object"
}
Implementation Reference
- server.js:355-368 (handler)The handler function that executes the tool logic: parses arguments using UserParamsSchema, calls the API client's listUserProjects method, and returns formatted JSON response as MCP content.handler: async (args) => { const { user, limit = 20, offset = 0 } = UserParamsSchema.parse(args); const result = await apiClient.listUserProjects(user, limit, offset); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Successfully retrieved ${result.items?.length || 0} projects for user ${user}` }, null, 2) }] }; }
- server.js:335-354 (schema)JSON Schema defining the input parameters for the list_user_projects tool, including user (required), limit, and offset.inputSchema: { type: "object", properties: { user: { type: "string", description: "Username" }, limit: { type: "number", description: "Number of projects to return (default: 20)", default: 20 }, offset: { type: "number", description: "Number of projects to skip (default: 0)", default: 0 } }, required: ["user"] },
- server.js:332-369 (registration)The complete tool registration object for 'list_user_projects' added to the tools array used by the MCP server for listing and calling tools.{ name: "list_user_projects", description: "List all projects for a specific user", inputSchema: { type: "object", properties: { user: { type: "string", description: "Username" }, limit: { type: "number", description: "Number of projects to return (default: 20)", default: 20 }, offset: { type: "number", description: "Number of projects to skip (default: 0)", default: 0 } }, required: ["user"] }, handler: async (args) => { const { user, limit = 20, offset = 0 } = UserParamsSchema.parse(args); const result = await apiClient.listUserProjects(user, limit, offset); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Successfully retrieved ${result.items?.length || 0} projects for user ${user}` }, null, 2) }] }; } },
- server.js:117-120 (helper)Helper method in WebSimAPIClient that makes the HTTP request to fetch a user's projects from the WebSim API.async listUserProjects(user, limit = 20, offset = 0) { const params = new URLSearchParams({ limit: limit.toString(), offset: offset.toString() }); return this.makeRequest(`/api/v1/users/${user}/projects?${params}`); }
- server.js:37-39 (schema)Zod schema used in the tool handler for validating the 'user' input parameter.const UserParamsSchema = z.object({ user: z.string().describe('Username') });