Skip to main content
Glama
promptingbox

PromptingBox MCP Server

by promptingbox

duplicate_prompt

Copy existing prompts to create duplicates with "(Copy)" appended to the title while preserving original folder structure and tags.

Instructions

Create a copy of an existing prompt. The copy gets "(Copy)" appended to the title and inherits the same folder and tags.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptIdNoThe prompt ID. Provide this or promptTitle.
promptTitleNoThe prompt title to search for. Provide this or promptId.

Implementation Reference

  • MCP tool registration and handler for 'duplicate_prompt'. Takes promptId or promptTitle as input, resolves the prompt ID, calls the API client to duplicate the prompt, and returns a success message with the duplicated prompt details including title, ID, and URL.
    server.tool(
      'duplicate_prompt',
      'Create a copy of an existing prompt. The copy gets "(Copy)" appended to the title and inherits the same folder and tags.',
      {
        promptId: z.string().optional().describe('The prompt ID. Provide this or promptTitle.'),
        promptTitle: z.string().optional().describe('The prompt title to search for. Provide this or promptId.'),
      },
      async ({ promptId, promptTitle }) => {
        try {
          const resolved = await resolvePromptId(promptId, promptTitle);
          if ('error' in resolved) return errorResult(resolved.error);
    
          const [result, suffix] = await Promise.all([
            client.duplicatePrompt(resolved.id),
            getResponseSuffix(),
          ]);
    
          return {
            content: [{
              type: 'text' as const,
              text: `Prompt duplicated!\n\nTitle: ${result.title}\nID: ${result.id}\nURL: ${result.url}\n\n${suffix}`,
            }],
          };
        } catch (err) {
          const message = err instanceof Error ? err.message : String(err);
          return errorResult(`Failed to duplicate prompt: ${message}`);
        }
      }
    );
  • API client method that makes a POST request to /api/mcp/prompt/{id}/duplicate to duplicate a prompt on the server. Returns the duplicated prompt's id, title, and url.
    async duplicatePrompt(id: string): Promise<{ id: string; title: string; url: string }> {
      return this.request(`/api/mcp/prompt/${id}/duplicate`, {
        method: 'POST',
      });
    }
  • Input schema for duplicate_prompt tool using zod validation. Accepts optional promptId or promptTitle parameters (at least one required) with descriptions.
    {
      promptId: z.string().optional().describe('The prompt ID. Provide this or promptTitle.'),
      promptTitle: z.string().optional().describe('The prompt title to search for. Provide this or promptId.'),
    },
  • Helper function resolvePromptId that resolves a prompt ID from either an explicit ID parameter or by searching for a prompt by title. Handles error cases for no matches or multiple matches.
    async function resolvePromptId(promptId?: string, promptTitle?: string): Promise<
      { id: string } | { error: string }
    > {
      if (promptId) return { id: promptId };
      if (!promptTitle) return { error: 'Provide either promptId or promptTitle.' };
    
      const all = await client.listPrompts();
      const lower = promptTitle.toLowerCase();
      const matches = all.filter((p) => p.title.toLowerCase().includes(lower));
    
      if (matches.length === 0) return { error: `No prompt found matching "${promptTitle}".` };
      if (matches.length > 1) {
        const list = matches.map((p) => `- ${p.title} (id: ${p.id})`).join('\n');
        return { error: `Multiple prompts match "${promptTitle}". Use promptId to be specific:\n${list}` };
      }
      return { id: matches[0].id };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only covers basic behavior (copying with title modification and inheritance). It misses critical details like whether this requires specific permissions, if it's idempotent, what happens on errors, or the response format. For a mutation tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two concise sentences with zero waste—each sentence adds essential information about the action and the copy's properties. It's front-loaded with the core purpose and efficiently structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't address permissions, error handling, or what the tool returns (e.g., the new prompt's ID). Given the complexity of duplicating resources, more behavioral context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are fully documented in the schema. The description adds no parameter-specific information beyond what the schema already states (e.g., it doesn't clarify if both promptId and promptTitle can be provided together or which takes precedence). Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Create a copy') and resource ('an existing prompt'), distinguishing it from siblings like 'update_prompt' or 'save_prompt'. It explicitly mentions what gets copied and how the copy is modified, making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when duplicating a prompt, but provides no explicit guidance on when to use this versus alternatives like 'update_prompt' for modifications or 'save_prompt' for creating new prompts from scratch. It lacks context about prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/promptingbox/mcp'

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