create_project
Create a new pixel art project by specifying canvas dimensions and a unique identifier. This tool initiates a blank canvas for drawing pixel art.
Instructions
Create a new pixel art project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Unique identifier for the project | |
| width | Yes | Canvas width in pixels | |
| height | Yes | Canvas height in pixels | |
| name | No | Project name (optional) |
Implementation Reference
- src/server/PiskelServer.ts:886-913 (handler)The createProject method serves as the handler for the 'create_project' tool, initializing a new Piskel project instance and adding it to the server's projects map.
private createProject( projectId: string, width: number, height: number, name?: string ): object { if (this.projects.has(projectId)) { throw new Error(`Project "${projectId}" already exists`); } const descriptor = { name: name ?? projectId }; const piskel = new Piskel(width, height, 1, descriptor); // Add a default layer with one frame const defaultLayer = new Layer('Layer 0'); defaultLayer.addFrame(new Frame(width, height)); piskel.addLayer(defaultLayer); this.projects.set(projectId, piskel); return { success: true, projectId, width, height, name: name ?? projectId, }; } - src/server/PiskelServer.ts:81-104 (registration)The tool 'create_project' is defined and registered within the getTools method in PiskelServer.ts, specifying its description and inputSchema.
{ name: 'create_project', description: 'Create a new pixel art project', inputSchema: { type: 'object', properties: { projectId: { type: 'string', description: 'Unique identifier for the project', }, width: { type: 'number', description: 'Canvas width in pixels', }, height: { type: 'number', description: 'Canvas height in pixels', }, name: { type: 'string', description: 'Project name (optional)', }, }, required: ['projectId', 'width', 'height'], - src/server/PiskelServer.ts:84-103 (schema)The inputSchema for 'create_project', defining the expected parameters: projectId, width, height, and optional name.
inputSchema: { type: 'object', properties: { projectId: { type: 'string', description: 'Unique identifier for the project', }, width: { type: 'number', description: 'Canvas width in pixels', }, height: { type: 'number', description: 'Canvas height in pixels', }, name: { type: 'string', description: 'Project name (optional)', }, },