Skip to main content
Glama
jezweb

Smart Prompts MCP Server

compose_prompts

Combine multiple existing prompts into a single prompt to create complex multi-step workflows. Use search_prompts first to find prompt names, then compose them with custom separators.

Instructions

šŸ”— Combine Prompts: Combine multiple existing prompts into a single prompt. Perfect for creating complex multi-step workflows. šŸ“‹ WORKFLOW: Use search_prompts to find prompt names first, then compose them.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptsYesList of exact prompt names to combine in order. Get these names from search_prompts results. Examples: ["code_review_assistant", "documentation_generator"]
separatorNoText to insert between prompts. Defaults to "\n\n---\n\n". Can use "\n\nNext Step:\n\n" or custom separators.

Implementation Reference

  • The primary handler function for the 'compose_prompts' tool. It validates the input prompts array, retrieves each prompt from the cache, handles missing prompts with errors, joins the contents with a customizable separator, and returns a formatted composed prompt.
    private handleComposePrompts(args: EnhancedToolArguments): CallToolResult {
      if (!args.prompts || args.prompts.length === 0) {
        throw new Error('At least one prompt name is required. šŸ’” TIP: Use search_prompts to find prompt names, then list them here.');
      }
      
      const separator = args.separator || '\n\n---\n\n';
      const composedParts: string[] = [];
      const notFound: string[] = [];
      
      for (const promptName of args.prompts) {
        const prompt = this.cache.getPrompt(promptName);
        if (prompt && prompt.content) {
          composedParts.push(prompt.content);
        } else {
          notFound.push(promptName);
        }
      }
      
      if (notFound.length > 0) {
        throw new Error(`Prompts not found: ${notFound.join(', ')}\n\nšŸ” Use search_prompts to find the correct prompt names. Make sure to use exact names from search results.`);
      }
      
      const composed = composedParts.join(separator);
      
      return {
        content: [
          {
            type: 'text',
            text: `# Composed Prompt\n\nCombined ${args.prompts.length} prompts:\n${args.prompts.map(p => `- ${p}`).join('\n')}\n\n## Result:\n\n${composed}`,
          } as TextContent,
        ],
      };
    }
  • Input schema definition for the compose_prompts tool, specifying the prompts array (required) and optional separator string.
    inputSchema: {
      type: 'object',
      properties: {
        prompts: {
          type: 'array',
          items: { type: 'string' },
          description: 'List of exact prompt names to combine in order. Get these names from search_prompts results. Examples: ["code_review_assistant", "documentation_generator"]',
        },
        separator: {
          type: 'string',
          description: 'Text to insert between prompts. Defaults to "\\n\\n---\\n\\n". Can use "\\n\\nNext Step:\\n\\n" or custom separators.',
        },
      },
      required: ['prompts'],
      examples: [
        { prompts: ["code_review_assistant", "documentation_generator"], description: "Review code then generate docs" },
        { prompts: ["api_documentation_generator", "testing_framework"], separator: "\\n\\nNext Task:\\n\\n", description: "Document API then create tests" }
      ],
    },
  • Registration of the compose_prompts tool in the getToolDefinitions() method, including name, description, and full input schema.
      name: 'compose_prompts',
      description: 'šŸ”— Combine Prompts: Combine multiple existing prompts into a single prompt. Perfect for creating complex multi-step workflows. šŸ“‹ WORKFLOW: Use search_prompts to find prompt names first, then compose them.',
      inputSchema: {
        type: 'object',
        properties: {
          prompts: {
            type: 'array',
            items: { type: 'string' },
            description: 'List of exact prompt names to combine in order. Get these names from search_prompts results. Examples: ["code_review_assistant", "documentation_generator"]',
          },
          separator: {
            type: 'string',
            description: 'Text to insert between prompts. Defaults to "\\n\\n---\\n\\n". Can use "\\n\\nNext Step:\\n\\n" or custom separators.',
          },
        },
        required: ['prompts'],
        examples: [
          { prompts: ["code_review_assistant", "documentation_generator"], description: "Review code then generate docs" },
          { prompts: ["api_documentation_generator", "testing_framework"], separator: "\\n\\nNext Task:\\n\\n", description: "Document API then create tests" }
        ],
      },
    },
  • Switch case in handleToolCall that routes compose_prompts calls to the handler method.
    case 'compose_prompts':
      return this.handleComposePrompts(toolArgs);
  • Alternative simpler inline handler for compose_prompts in what appears to be an original or backup entry point file.
    case 'compose_prompts': {
      const promptNames = request.params.arguments?.prompts as string[];
      const separator = (request.params.arguments?.separator as string) || '\n\n---\n\n';
      const composed = promptNames
        .map(name => {
          const prompt = cache.getPrompt(name);
          return prompt ? prompt.content : null;
        })
        .filter(Boolean)
        .join(separator);
      
      return {
        content: [
          {
            type: 'text',
            text: composed,
          },
        ],
      };
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It describes the tool's behavior (combining prompts in order with a separator) and hints at workflow integration, but lacks details on error handling, output format, or limitations (e.g., maximum number of prompts). It doesn't contradict annotations, but could be more comprehensive for a mutation tool.

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

Conciseness4/5

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

The description is front-loaded with the core purpose, followed by usage guidelines. It uses two sentences efficiently, though the emojis and formatting (e.g., 'šŸ“‹ WORKFLOW:') add minor clutter. Overall, it's concise and well-structured for quick comprehension.

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

Completeness4/5

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

Given the tool's moderate complexity (combining prompts), no annotations, and no output schema, the description does a good job covering purpose and usage. However, it lacks details on the output (e.g., what the combined prompt looks like) and potential constraints, leaving some gaps for an agent to infer behavior.

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

Parameters4/5

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

Schema description coverage is 100%, so the schema already documents both parameters thoroughly. The description adds context by mentioning 'prompt names' and referencing search_prompts, but doesn't provide additional semantic details beyond what's in the schema. Since parameters are well-covered, a baseline of 3 is appropriate, but the workflow reference slightly enhances understanding.

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 ('Combine multiple existing prompts into a single prompt') and resource ('prompts'), distinguishing it from siblings like search_prompts (which finds prompts) or get_prompt (which retrieves a single prompt). The emoji and title-like phrasing reinforce the purpose without being tautological.

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

Usage Guidelines5/5

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

It explicitly states when to use this tool ('Perfect for creating complex multi-step workflows') and provides a clear workflow instruction: 'Use search_prompts to find prompt names first, then compose them.' This directly addresses when to use it versus alternatives like search_prompts, offering practical guidance.

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/jezweb/smart-prompts-mcp'

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