Skip to main content
Glama
ronniemh
by ronniemh

create-phrase

Add new inspirational phrases with author attribution to manage and organize motivational content within the Phrases MCP Server.

Instructions

Creates a new phrase for an author.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesAuthor name
phraseYesPhrase text

Implementation Reference

  • Handler function that executes the create-phrase tool logic by sending a POST request to the mock API with the provided name and phrase, then formats and returns the result.
    async ({name, phrase}) => {
        const created = await makeMockAPIRequest<Phrase>("POST", {
            body: { name, phrase },
        });
    
        const resultText = created
            ? `Created phrase for ${created.name}: "${created.phrase}" (ID: ${created.id})`
            : "Failed to create the phrase.";
    
        return {
            content: [
                {
                    type: "text",
                    text: resultText
                }
            ]
        }
    }
  • Input schema using Zod for validating the 'name' and 'phrase' parameters of the create-phrase tool.
    {
        name: z.string().max(50).describe("Author name"),
        phrase: z.string().max(200).describe("Phrase text")
    },
  • src/index.ts:100-125 (registration)
    Registration of the 'create-phrase' tool using server.tool, including name, description, schema, and inline handler.
    server.tool(
        "create-phrase",
        "Creates a new phrase for an author.",
        {
            name: z.string().max(50).describe("Author name"),
            phrase: z.string().max(200).describe("Phrase text")
        },
        async ({name, phrase}) => {
            const created = await makeMockAPIRequest<Phrase>("POST", {
                body: { name, phrase },
            });
    
            const resultText = created
                ? `Created phrase for ${created.name}: "${created.phrase}" (ID: ${created.id})`
                : "Failed to create the phrase.";
    
            return {
                content: [
                    {
                        type: "text",
                        text: resultText
                    }
                ]
            }
        }
    );
  • Helper function makeMockAPIRequest used by the create-phrase handler to perform the actual HTTP POST request to the mock API.
    export async function makeMockAPIRequest<T>(
        method: HTTPMethod,
        options: RequestOptions = {}
    ): Promise<T | null> {
        const { path, queryParams, body } = options;
        let url = BASE_URL;
    
        if (path) url += path;
        if (method === "GET" && queryParams) {
            const query = new URLSearchParams(queryParams).toString();
            url += `?${query}`;
        }
    
        const headers: HeadersInit = {
            "Content-Type": "application/json",
        };
    
        const fetchOptions: RequestInit = {
            method,
            headers,
            body: body && method !== "GET" && method !== "DELETE"
                ? JSON.stringify(body)
                : undefined,
        };
    
        try {
            const response = await fetch(url, fetchOptions);
            if (!response.ok) throw new Error(`HTTP error: ${response.status}`);
            if (method === "DELETE" || response.status === 204) return null;
            return await response.json();
        } catch (err) {
            console.error(`Error on ${method} ${url}:`, err);
            return null;
        }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'creates a new phrase,' implying a write operation, but doesn't cover critical aspects like permissions needed, whether the operation is idempotent, error handling, or what happens on success (e.g., returns a phrase ID). This leaves significant gaps in understanding the tool's behavior.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, making it easy to parse quickly.

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?

Given the tool's complexity as a creation operation with no annotations and no output schema, the description is incomplete. It fails to explain what the tool returns (e.g., a phrase ID or confirmation), error conditions, or behavioral nuances, making it inadequate for safe and effective use by an AI agent.

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?

The input schema has 100% description coverage, with clear documentation for both parameters ('name' as author name and 'phrase' as phrase text). The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline score of 3 without compensating for any gaps.

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 ('creates') and resource ('a new phrase for an author'), making the purpose understandable. However, it doesn't explicitly distinguish this tool from its sibling 'update-phrase' (which might modify existing phrases) or clarify what constitutes a 'phrase' in this context, preventing a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'update-phrase' for modifying phrases or 'get-phrase-by-name' for retrieval. It also lacks prerequisites, such as whether the author must exist or if authentication is required, leaving usage context unclear.

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/ronniemh/phrases-MCP-server'

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