create-prompt
Generate a new prompt by specifying its name, enabling structured input creation within the Opik platform's Model Context Protocol environment.
Instructions
Create a new prompt
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the prompt |
Implementation Reference
- src/tools/prompt.ts:50-69 (handler)Handler function for 'create-prompt' tool that sends a POST request to create a new prompt with name, optional description and tags.async (args: any) => { const { name, description, tags } = args; const requestBody: any = { name }; if (description) requestBody.description = description; if (tags) requestBody.tags = tags; const response = await makeApiRequest<any>(`/v1/private/prompts`, { method: 'POST', body: JSON.stringify(requestBody), }); return { content: [ { type: 'text', text: response.error || 'Successfully created prompt', }, ], }; }
- src/tools/prompt.ts:45-49 (schema)Input schema using Zod for validating arguments: name (required string), description (optional string), tags (optional array of strings).{ name: z.string().min(1).describe('Name of the prompt'), description: z.string().optional().describe('Description of the prompt'), tags: z.array(z.string()).optional().describe('List of tags for the prompt'), },
- src/tools/prompt.ts:42-70 (registration)Registration of the 'create-prompt' tool using server.tool, including name, description, schema, and handler function.server.tool( 'create-prompt', 'Create a new prompt', { name: z.string().min(1).describe('Name of the prompt'), description: z.string().optional().describe('Description of the prompt'), tags: z.array(z.string()).optional().describe('List of tags for the prompt'), }, async (args: any) => { const { name, description, tags } = args; const requestBody: any = { name }; if (description) requestBody.description = description; if (tags) requestBody.tags = tags; const response = await makeApiRequest<any>(`/v1/private/prompts`, { method: 'POST', body: JSON.stringify(requestBody), }); return { content: [ { type: 'text', text: response.error || 'Successfully created prompt', }, ], }; } );