Skip to main content
Glama

sample-tool

Demonstrates how to build custom tools for AI assistants using the MCP Server Template. This sample tool accepts input parameters to show extension creation workflows.

Instructions

A sample tool for demonstration purposes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesInput parameter for the sample tool

Implementation Reference

  • index.ts:18-31 (handler)
    The asynchronous handler function for the 'sample-tool' that takes an input string, processes it by prefixing 'Processed: ', and returns it as text content.
    async ({ input }) => {
      // Process the input
      const output = `Processed: ${input}`;
      
      // Return the result
      return {
        content: [
          {
            type: "text",
            text: output,
          },
        ],
      };
    }
  • The input schema for the 'sample-tool' defined using Zod, specifying a single string input parameter.
    {
      input: z.string().describe("Input parameter for the sample tool"),
    },
  • index.ts:12-32 (registration)
    The registration of the 'sample-tool' on the MCP server, including name, description, input schema, and handler function.
    server.tool(
      "sample-tool",
      "A sample tool for demonstration purposes",
      {
        input: z.string().describe("Input parameter for the sample tool"),
      },
      async ({ input }) => {
        // Process the input
        const output = `Processed: ${input}`;
        
        // Return the result
        return {
          content: [
            {
              type: "text",
              text: output,
            },
          ],
        };
      }
    );
Behavior1/5

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

The description provides zero behavioral information beyond the name. With no annotations provided, the description carries the full burden of disclosing behavioral traits like whether this is a read or write operation, what side effects it might have, authentication requirements, or rate limits. The description fails to address any of these aspects, leaving the agent completely in the dark about how this tool behaves.

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 extremely concise at just one sentence with no wasted words. It's appropriately sized for what little information it conveys, and while it's under-specified, it's not verbose or poorly structured. Every word in 'A sample tool for demonstration purposes' serves its purpose within the minimal context provided.

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 that this is a tool with one parameter, no annotations, no output schema, and no sibling tools, the description is incomplete. It fails to explain what the tool actually does, what behavior to expect, or what context it operates in. While the simplicity of the tool might lower expectations, the description doesn't provide enough information for an agent to understand when and how to use it effectively.

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?

With 100% schema description coverage and only one parameter documented in the schema, the description adds no additional parameter information. The schema already describes the 'input' parameter as 'Input parameter for the sample tool,' so the description doesn't compensate or add meaning beyond what's in the structured data. This meets the baseline of 3 when schema coverage is high.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

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

The description 'A sample tool for demonstration purposes' is a tautology that essentially restates the tool name 'sample-tool' without specifying what it actually does. It doesn't mention any specific verb or resource, nor does it explain what kind of demonstration it performs. While it's not misleading, it provides minimal functional information beyond the name itself.

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, what context it's appropriate for, or what alternatives might exist. With no sibling tools mentioned, there's no need for differentiation, but the description fails to establish any usage context whatsoever. It doesn't indicate whether this is for testing, learning, or any specific scenario.

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/hypermodel-labs/mcp-server-template'

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