create_event
Create new events by specifying title, description, times, location, and capacity for event management and scheduling.
Instructions
Create a new event. Requires title, description, start/end times, location, and capacity.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"title": "<title>",
"description": "<description>",
"start_time": "<start_time>",
"end_time": "<end_time>",
"location": "<location>",
"capacity": "<capacity>"
},
"name": "create_event"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Title of the event | |
| description | Yes | Description of the event | |
| start_time | Yes | Start time in ISO 8601 format (e.g., 2024-12-25T10:00:00Z) | |
| end_time | Yes | End time in ISO 8601 format (e.g., 2024-12-25T18:00:00Z) | |
| location | Yes | Location of the event | |
| capacity | Yes | Maximum number of attendees |
Implementation Reference
- src/index.ts:119-139 (handler)The handler function for the 'create_event' MCP tool. It extracts parameters, calls the API client to create the event, formats the response using formatEvent, and returns MCP-formatted content or error.
async ({ title, description, start_time, end_time, location, capacity }) => { try { const apiClient = getClient(); const event = await apiClient.createEvent({ title, description, start_time, end_time, location, capacity }); return { content: [{ type: 'text', text: `Event created successfully!\n\n${formatEvent(event)}` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } - src/index.ts:111-118 (schema)Zod schema defining the input parameters for the 'create_event' MCP tool.
{ title: z.string().describe('Title of the event'), description: z.string().describe('Description of the event'), start_time: z.string().describe('Start time in ISO 8601 format (e.g., 2024-12-25T10:00:00Z)'), end_time: z.string().describe('End time in ISO 8601 format (e.g., 2024-12-25T18:00:00Z)'), location: z.string().describe('Location of the event'), capacity: z.number().describe('Maximum number of attendees') }, - src/index.ts:108-140 (registration)Complete registration of the 'create_event' MCP tool using server.tool, including name, description, schema, and inline handler.
server.tool( 'create_event', 'Create a new event. Requires title, description, start/end times, location, and capacity.', { title: z.string().describe('Title of the event'), description: z.string().describe('Description of the event'), start_time: z.string().describe('Start time in ISO 8601 format (e.g., 2024-12-25T10:00:00Z)'), end_time: z.string().describe('End time in ISO 8601 format (e.g., 2024-12-25T18:00:00Z)'), location: z.string().describe('Location of the event'), capacity: z.number().describe('Maximum number of attendees') }, async ({ title, description, start_time, end_time, location, capacity }) => { try { const apiClient = getClient(); const event = await apiClient.createEvent({ title, description, start_time, end_time, location, capacity }); return { content: [{ type: 'text', text: `Event created successfully!\n\n${formatEvent(event)}` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } ); - src/api-client.ts:130-137 (helper)API client method called by the MCP handler to perform the actual HTTP POST to create the event.
async createEvent(eventData: EventCreateRequest): Promise<Event> { try { const response: AxiosResponse<Event> = await this.client.post('/api/events/', eventData); return response.data; } catch (error) { throw new Error(`Failed to create event: ${getErrorMessage(error)}`); } } - src/api-client.ts:53-61 (schema)TypeScript interface for the event creation request data structure used by the API client.
export interface EventCreateRequest { title: string; description: string; start_time: string; end_time: string; location: string; capacity: number; registration_schema?: Record<string, unknown>[]; }