Skip to main content
Glama
ronniemh
by ronniemh

get-phrase-by-name

Retrieve inspirational phrases by specifying an author's name to access their attributed quotes within the Phrases MCP Server.

Instructions

Returns a phrase by author name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesAuthor name

Implementation Reference

  • The core handler logic for the 'get-phrase-by-name' tool. It queries the mock API for phrases matching the author name and returns a formatted text response.
    async ({name}) => {
        const result = await makeMockAPIRequest<Phrase[]>("GET", {
            queryParams: { name },
        });
    
        const resultText = result && result[0]
            ? `Phrase from ${name}: "${result[0].phrase}" (ID: ${result[0].id})`
            : `No phrase found for ${name}.`;
    
        return {
            content: [
                {
                    type: "text",
                    text: resultText
                }
            ]
        }
    }
  • Zod schema defining the input parameter 'name' for the tool.
    {
        name: z.string().max(20).describe("Author name"),
    },
  • src/index.ts:73-97 (registration)
    Registration of the 'get-phrase-by-name' tool using server.tool, including name, description, schema, and handler.
    server.tool(
        "get-phrase-by-name",
        "Returns a phrase by author name.",
        {
            name: z.string().max(20).describe("Author name"),
        },
        async ({name}) => {
            const result = await makeMockAPIRequest<Phrase[]>("GET", {
                queryParams: { name },
            });
    
            const resultText = result && result[0]
                ? `Phrase from ${name}: "${result[0].phrase}" (ID: ${result[0].id})`
                : `No phrase found for ${name}.`;
    
            return {
                content: [
                    {
                        type: "text",
                        text: resultText
                    }
                ]
            }
        }
    );
  • Supporting helper function makeMockAPIRequest used by the tool handler to fetch data from 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 full burden but offers minimal behavioral insight. It states a read operation ('Returns'), but doesn't disclose error handling, authentication needs, rate limits, or what happens if no phrase matches the author name. More context is needed for a mutation-heavy sibling environment.

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 and appropriately sized for a simple retrieval tool, earning its place without unnecessary elaboration.

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 complexity of sibling tools (including mutations like 'create-phrase' and 'delete-phrase'), no annotations, and no output schema, the description is incomplete. It doesn't explain return values, error cases, or how it fits into the broader toolset, leaving gaps for agent understanding.

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%, with the parameter 'name' documented as 'Author name'. The description adds no additional meaning beyond this, such as format examples or constraints. Baseline 3 is appropriate since the schema adequately covers the single parameter.

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 ('Returns') and resource ('a phrase'), specifying it's retrieved 'by author name'. It distinguishes from siblings like 'get-phrase-by-id' by indicating the lookup method, but doesn't explicitly contrast with 'get-all-phrases' or other retrieval tools.

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?

No guidance is provided on when to use this tool versus alternatives like 'get-phrase-by-id' or 'get-all-phrases'. The description implies usage for phrase retrieval by author name, but lacks explicit context, 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/ronniemh/phrases-MCP-server'

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