Skip to main content
Glama
ronniemh
by ronniemh

update-phrase

Modify existing inspirational phrases by ID to update their text content within the Phrases MCP Server.

Instructions

Updates the text of a phrase by its ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesPhrase ID
phraseYesNew phrase text

Implementation Reference

  • Handler function that performs the PATCH request to update the phrase by ID using the mock API and returns a success or failure message.
    async ({id, phrase}) => {
        const result = await makeMockAPIRequest<Phrase>("PATCH", {
            path: `/${id}`,
            body: { phrase },
        });
    
        const resultText = result
            ? `Updated phrase for ${result.name}: "${result.phrase}"`
            : `Failed to update phrase with ID ${id}.`;
    
        return {
            content: [
                {
                    type: "text",
                    text: resultText
                }
            ]
        }
    }
  • Zod schema for the tool inputs: phrase ID (number >=0) and new phrase text (string max 200 chars).
    {
        id: z.number().min(0).describe("Phrase ID"),
        phrase: z.string().max(200).describe("New phrase text")
    },
  • src/index.ts:128-154 (registration)
    Full registration of the 'update-phrase' tool on the MCP server, including name, description, input schema, and handler function.
    server.tool(
        "update-phrase",
        "Updates the text of a phrase by its ID.",
        {
            id: z.number().min(0).describe("Phrase ID"),
            phrase: z.string().max(200).describe("New phrase text")
        },
        async ({id, phrase}) => {
            const result = await makeMockAPIRequest<Phrase>("PATCH", {
                path: `/${id}`,
                body: { phrase },
            });
    
            const resultText = result
                ? `Updated phrase for ${result.name}: "${result.phrase}"`
                : `Failed to update phrase with ID ${id}.`;
    
            return {
                content: [
                    {
                        type: "text",
                        text: resultText
                    }
                ]
            }
        }
    );
  • Shared helper function that makes HTTP requests to the mock API endpoint, used by all phrase tools including update-phrase.
    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;
        }
    }
  • TypeScript type for update-phrase parameters: id and phrase.
    export type UpdatePhraseParams = { id: number } & Required<Pick<PhraseInput, "phrase">>;
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 offers minimal behavioral insight. It states 'Updates the text' implying a mutation, but doesn't disclose permissions required, whether changes are reversible, error handling (e.g., invalid ID), or rate limits. This leaves significant gaps 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.

Conciseness5/5

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

The description is a single, efficient sentence with zero waste. It's front-loaded with the core action and resource, making it easy to parse quickly. Every word earns its place without redundancy.

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 this is a mutation tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits (e.g., side effects, error responses), usage context, or return values, which are critical for safe and effective tool invocation in a multi-tool environment.

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 'id' and 'phrase' are fully documented in the schema. The description adds no additional meaning beyond implying 'id' identifies the phrase to update and 'phrase' is the new text, which is already clear from schema descriptions. Baseline 3 is appropriate as the 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 ('Updates') and resource ('text of a phrase by its ID'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'create-phrase' or 'delete-phrase', but the specificity of updating by ID provides some implicit distinction.

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. It doesn't mention prerequisites (e.g., needing an existing phrase ID), exclusions, or comparisons to siblings like 'create-phrase' for new phrases or 'get-phrase-by-id' for retrieval.

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