get_project_by_slug
Retrieve a WebSim project using the creator's username and project identifier to access specific content from the public API.
Instructions
Get a WebSim project by user and slug
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user | Yes | Username | |
| slug | Yes | Project slug |
Input Schema (JSON Schema)
{
"properties": {
"slug": {
"description": "Project slug",
"type": "string"
},
"user": {
"description": "Username",
"type": "string"
}
},
"required": [
"user",
"slug"
],
"type": "object"
}
Implementation Reference
- server.js:284-297 (handler)MCP tool handler that validates input with UserSlugSchema, fetches project data via API client, and returns JSON-formatted response.handler: async (args) => { const { user, slug } = UserSlugSchema.parse(args); const result = await apiClient.getProjectBySlug(user, slug); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Successfully retrieved project ${user}/${slug}` }, null, 2) }] }; }
- server.js:27-30 (schema)Zod schema used for input validation in the get_project_by_slug handler.const UserSlugSchema = z.object({ user: z.string().describe('Username'), slug: z.string().describe('Project slug') });
- server.js:267-298 (registration)Tool registration object in the tools array, defining name, description, input schema, and handler reference.{ name: "get_project_by_slug", description: "Get a WebSim project by user and slug", inputSchema: { type: "object", properties: { user: { type: "string", description: "Username" }, slug: { type: "string", description: "Project slug" } }, required: ["user", "slug"] }, handler: async (args) => { const { user, slug } = UserSlugSchema.parse(args); const result = await apiClient.getProjectBySlug(user, slug); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Successfully retrieved project ${user}/${slug}` }, null, 2) }] }; } },
- server.js:108-110 (helper)WebSimAPIClient helper method that performs the HTTP request to retrieve project by user and slug.async getProjectBySlug(user, slug) { return this.makeRequest(`/api/v1/users/${user}/slugs/${slug}`); }