Skip to main content
Glama
promptingbox

PromptingBox MCP Server

by promptingbox

search_templates

Search and browse public prompt templates to find pre-built prompts for saving to your personal collection. Filter by category and control result quantity.

Instructions

Browse and search the PromptingBox public template library. Find pre-built prompts you can save to your collection.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoSearch text to match against template titles and descriptions
categoryNoFilter by category (e.g. "Business", "Writing", "Development")
limitNoNumber of results to return (default 10)

Implementation Reference

  • The main handler function for search_templates that processes user requests, calls the API client, and formats the response with template listings including titles, descriptions, categories, IDs, and usage counts.
    // ── search_templates ────────────────────────────────────────────────────────
    server.tool(
      'search_templates',
      'Browse and search the PromptingBox public template library. Find pre-built prompts you can save to your collection.',
      {
        query: z.string().optional().describe('Search text to match against template titles and descriptions'),
        category: z.string().optional().describe('Filter by category (e.g. "Business", "Writing", "Development")'),
        limit: z.number().int().min(1).max(50).optional().default(10).describe('Number of results to return (default 10)'),
      },
      async ({ query, category, limit }) => {
        try {
          const result = await client.searchTemplates({ search: query, category, limit });
    
          const suffix = await getResponseSuffix();
    
          if (result.templates.length === 0) {
            return {
              content: [{ type: 'text' as const, text: `No templates found matching your search.\n\n${suffix}` }],
            };
          }
    
          const lines = result.templates.map((t) =>
            `- **${t.title}** (${t.category})${t.description ? ` — ${t.description}` : ''}\n  ID: \`${t.id}\` | Used ${t.usageCount} times`
          );
    
          return {
            content: [{
              type: 'text' as const,
              text: `Found ${result.pagination.total} template${result.pagination.total === 1 ? '' : 's'}` +
                `${result.pagination.hasMore ? ` (showing first ${result.templates.length})` : ''}:\n\n${lines.join('\n\n')}` +
                `\n\nUse \`use_template\` with the template ID to save one to your collection.\n\n${suffix}`,
            }],
          };
        } catch (err) {
          const message = err instanceof Error ? err.message : String(err);
          return errorResult(`Failed to search templates: ${message}`);
        }
      }
    );
  • Input validation schema defining the three optional parameters: query (search text), category (filter by category), and limit (number of results with validation 1-50 and default 10).
    {
      query: z.string().optional().describe('Search text to match against template titles and descriptions'),
      category: z.string().optional().describe('Filter by category (e.g. "Business", "Writing", "Development")'),
      limit: z.number().int().min(1).max(50).optional().default(10).describe('Number of results to return (default 10)'),
    },
  • src/index.ts:563-600 (registration)
    Tool registration with the MCP server using server.tool() method, including tool name, description, schema, and async handler function.
    server.tool(
      'search_templates',
      'Browse and search the PromptingBox public template library. Find pre-built prompts you can save to your collection.',
      {
        query: z.string().optional().describe('Search text to match against template titles and descriptions'),
        category: z.string().optional().describe('Filter by category (e.g. "Business", "Writing", "Development")'),
        limit: z.number().int().min(1).max(50).optional().default(10).describe('Number of results to return (default 10)'),
      },
      async ({ query, category, limit }) => {
        try {
          const result = await client.searchTemplates({ search: query, category, limit });
    
          const suffix = await getResponseSuffix();
    
          if (result.templates.length === 0) {
            return {
              content: [{ type: 'text' as const, text: `No templates found matching your search.\n\n${suffix}` }],
            };
          }
    
          const lines = result.templates.map((t) =>
            `- **${t.title}** (${t.category})${t.description ? ` — ${t.description}` : ''}\n  ID: \`${t.id}\` | Used ${t.usageCount} times`
          );
    
          return {
            content: [{
              type: 'text' as const,
              text: `Found ${result.pagination.total} template${result.pagination.total === 1 ? '' : 's'}` +
                `${result.pagination.hasMore ? ` (showing first ${result.templates.length})` : ''}:\n\n${lines.join('\n\n')}` +
                `\n\nUse \`use_template\` with the template ID to save one to your collection.\n\n${suffix}`,
            }],
          };
        } catch (err) {
          const message = err instanceof Error ? err.message : String(err);
          return errorResult(`Failed to search templates: ${message}`);
        }
      }
    );
  • API client method that constructs the query string from parameters and makes the actual HTTP request to the /api/mcp/template endpoint.
    async searchTemplates(params?: { search?: string; category?: string; limit?: number; page?: number }): Promise<TemplateSearchResult> {
      const qs = new URLSearchParams();
      if (params?.search) qs.set('search', params.search);
      if (params?.category) qs.set('category', params.category);
      if (params?.limit) qs.set('limit', String(params.limit));
      if (params?.page) qs.set('page', String(params.page));
      const query = qs.toString();
      return this.request<TemplateSearchResult>(`/api/mcp/template${query ? `?${query}` : ''}`);
    }
  • TypeScript type definitions for the API response: TemplateListItem (id, title, description, category, icon, usageCount) and TemplateSearchResult (templates array with pagination info).
    export interface TemplateListItem {
      id: string;
      title: string;
      description: string | null;
      category: string;
      icon: string | null;
      usageCount: number;
    }
    
    export interface TemplateDetail {
      id: string;
      title: string;
      content: string;
      description: string | null;
      category: string;
      icon: string | null;
      usageCount: number;
    }
    
    export interface TemplateSearchResult {
      templates: TemplateListItem[];
      pagination: {
        page: number;
        limit: number;
        total: number;
        hasMore: boolean;
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'browse and search' and that results can be saved, but doesn't disclose behavioral traits like whether this is a read-only operation, if it requires authentication, rate limits, pagination behavior, or what the output format looks like. For a search tool with no annotations, this is a significant gap.

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. It front-loads the core purpose and follows with the outcome, making it easy to parse quickly.

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

Completeness3/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 (search with filtering), 100% schema coverage but no annotations and no output schema, the description is minimally adequate. It covers the what and why but lacks details on behavior, output, or integration with siblings like 'use_template'. It meets basic needs but has clear gaps in completeness.

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 the schema already documents all three parameters (query, category, limit) with clear descriptions. The description adds no additional parameter semantics beyond what's in the schema, such as search ranking or category examples beyond those implied. 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.

Purpose4/5

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

The description clearly states the action ('Browse and search') and resource ('PromptingBox public template library'), and distinguishes it from sibling tools like 'search_prompts' by specifying it searches templates rather than prompts. However, it doesn't explicitly contrast with 'use_template', which might be a related action.

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 for finding pre-built prompts to save, but doesn't explicitly state when to use this versus alternatives like 'search_prompts' or 'use_template'. It provides some context (public template library) but lacks clear exclusions or comparison to siblings.

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