coderswap_create_project
Create a new vector search project to build topic-specific knowledge bases for semantic search and research workflows.
Instructions
Create a new vector search project in CoderSwap
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| description | No |
Input Schema (JSON Schema)
{
"properties": {
"description": {
"type": "string"
},
"name": {
"minLength": 1,
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
}
Implementation Reference
- src/index.ts:204-234 (handler)MCP tool handler function that calls CoderSwapClient.createProject, processes the response, and returns formatted success/error output.async ({ name, description }) => { try { log('debug', 'Creating project', { name, description }) const project: any = await client.createProject({ name, description }) const output = { project_id: project.project_id, name: project.name || name, status: project.status } log('info', `Created project: ${project.project_id}`) return { content: [{ type: 'text', text: `✓ Created project "${name}" (ID: ${project.project_id})` }], structuredContent: output } } catch (error) { log('error', 'Failed to create project', { error: error instanceof Error ? error.message : error }) return { content: [{ type: 'text', text: `✗ Failed to create project: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true } } }
- src/index.ts:190-235 (registration)Registration of the 'coderswap_create_project' tool with schema and inline handler function.'coderswap_create_project', { title: 'Create CoderSwap Project', description: 'Create a new vector search project in CoderSwap', inputSchema: { name: z.string().min(1, 'Project name is required'), description: z.string().optional() }, outputSchema: { project_id: z.string(), name: z.string(), status: z.string().optional() } }, async ({ name, description }) => { try { log('debug', 'Creating project', { name, description }) const project: any = await client.createProject({ name, description }) const output = { project_id: project.project_id, name: project.name || name, status: project.status } log('info', `Created project: ${project.project_id}`) return { content: [{ type: 'text', text: `✓ Created project "${name}" (ID: ${project.project_id})` }], structuredContent: output } } catch (error) { log('error', 'Failed to create project', { error: error instanceof Error ? error.message : error }) return { content: [{ type: 'text', text: `✗ Failed to create project: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true } } } )
- src/coderswap-client.ts:76-87 (helper)Core helper method in CoderSwapClient that performs the HTTP POST request to create a project via the API, setting embedding_dim to 384.async createProject(input: CreateProjectInput) { const res = await fetch(`${this.baseUrl}/v1/projects`, { method: 'POST', headers: this.headers, body: JSON.stringify({ name: input.name, description: input.description, embedding_dim: 384 }) }) return this.handleResponse(res) }
- src/types.ts:3-6 (schema)Zod schema definition for CreateProjectInput used by the client and matching the tool's inputSchema.export const createProjectSchema = z.object({ name: z.string().min(1, 'Project name is required'), description: z.string().optional() })