Skip to main content
Glama

createProject

Create a new project with a title and email using the DeepWriter API key for authentication. Streamlines project setup for content generation and management.

Instructions

Create a new project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyYesThe DeepWriter API key for authentication.
emailYesThe email associated with the project.
titleYesThe title for the new project.

Implementation Reference

  • The core handler implementation for the 'createProject' tool. This defines the tool object with name, description, and the execute function that validates inputs, calls the DeepWriter API via apiClient.createProject, and returns MCP-formatted response.
    export const createProjectTool = { name: "createProject", description: "Create a new project", // TODO: Add input/output schema validation if needed async execute(args: CreateProjectInputArgs): Promise<CreateProjectMcpOutput> { console.error(`Executing createProject tool with title: ${args.title}...`); // Get API key from environment const apiKey = process.env.DEEPWRITER_API_KEY; if (!apiKey) { throw new Error("DEEPWRITER_API_KEY environment variable is required"); } if (!args.title || args.title.trim() === '') { throw new Error("Missing required argument: title (cannot be empty)"); } if (!args.email) { throw new Error("Missing required argument: email"); } try { // Call the actual API client function const apiResponse = await apiClient.createProject(apiKey, args.title, args.email); console.error(`API call successful for createProject. New project ID: ${apiResponse.id}`); // Transform the API response into MCP format const mcpResponse: CreateProjectMcpOutput = { content: [ { type: 'text', text: `Successfully created project '${args.title}' with ID: ${apiResponse.id}` } ] }; return mcpResponse; // Return the MCP-compliant structure } catch (error) { console.error(`Error executing createProject tool: ${error}`); // Format error for MCP response const errorMessage = error instanceof Error ? error.message : String(error); throw new Error(`Failed to create project: ${errorMessage}`); } } };
  • src/index.ts:233-254 (registration)
    Registration of the 'createProject' tool with the MCP server using server.tool(). Includes inline input schema validation with Zod, a wrapper async handler that delegates to createProjectTool.execute, and tool annotations.
    server.tool( createProjectTool.name, createProjectTool.description, { title: z.string().describe("The title for the new project."), email: z.string().email().describe("The email associated with the project.") }, async ({ title, email }: CreateProjectParams) => { console.error(`SDK invoking ${createProjectTool.name}...`); const result = await createProjectTool.execute({ title, email }); return { content: result.content, annotations: { title: "Create Project", readOnlyHint: false, destructiveHint: false, // Creates but doesn't destroy idempotentHint: false, // Creates new project each time openWorldHint: false } }; } );
  • Zod input schema definition for createProject tool parameters (title and email), matching the inline schema used in registration.
    const createProjectInputSchema = z.object({ title: z.string().describe("The title for the new project."), email: z.string().email().describe("The email associated with the project.") });
  • Helper function that makes the actual HTTP POST request to the DeepWriter API to create a project. Called by the tool handler. Note: email is accepted but not used in API call.
    export async function createProject(apiKey: string, title: string, email: string): Promise<CreateProjectResponse> { console.error(`Calling actual createProject API with title: ${title}`); if (!apiKey) { throw new Error("API key is required for createProject"); } if (!title || title.trim() === '') { throw new Error("Project title is required for createProject"); } // Note: email parameter accepted for MCP interface compatibility but not sent to API // Use the correct field name 'newProjectName' for the API request body (email not needed) const body: CreateProjectApiInput = { newProjectName: title }; return makeApiRequest<CreateProjectResponse>('/api/createProject', apiKey, 'POST', body); }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/deepwriter-ai/Deepwriter-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server