Skip to main content
Glama
comet-ml

Opik MCP Server

by comet-ml

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
NameRequiredDescriptionDefault
nameYesName of the prompt

Implementation Reference

  • 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',
          },
        ],
      };
    }
  • 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'),
    },
  • 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',
            },
          ],
        };
      }
    );

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/comet-ml/opik-mcp'

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