get_project_by_id
Retrieve a WebSim project using its unique ID to access and view project details through the WebSim MCP Server.
Instructions
Get a WebSim project by its ID
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:252-265 (handler)MCP tool handler for get_project_by_id: parses input args using Zod schema, calls the API client helper, formats and returns JSON response as text content.handler: async (args) => { const { project_id } = ProjectIdSchema.parse(args); const result = await apiClient.getProjectById(project_id); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Successfully retrieved project ${project_id}` }, null, 2) }] }; }
- server.js:242-251 (schema)MCP input schema for the get_project_by_id tool defining the project_id parameter.inputSchema: { type: "object", properties: { project_id: { type: "string", description: "WebSim project ID" } }, required: ["project_id"] },
- server.js:239-266 (registration)Full tool definition object for get_project_by_id registered in the tools array used by MCP server request handlers.{ name: "get_project_by_id", description: "Get a WebSim project by its ID", 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.getProjectById(project_id); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Successfully retrieved project ${project_id}` }, null, 2) }] }; } },
- server.js:23-25 (schema)Zod schema for validating the project_id input parameter used in the tool handler.const ProjectIdSchema = z.object({ project_id: z.string().describe('WebSim project ID') });
- server.js:104-106 (helper)WebSimAPIClient helper method that performs the HTTP request to fetch project data by ID from the WebSim API.async getProjectById(projectId) { return this.makeRequest(`/api/v1/projects/${projectId}`); }