Skip to main content
Glama

sample-tool

Generate AI assistant tools with the MCP Server Template. Use this sample tool to process input parameters and build custom extensions for enhanced functionality.

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 'sample-tool' that takes an input string, processes it by prefixing 'Processed: ', and returns a text content block.
    async ({ input }) => { // Process the input const output = `Processed: ${input}`; // Return the result return { content: [ { type: "text", text: output, }, ], }; }
  • index.ts:12-32 (registration)
    The server.tool() call that registers 'sample-tool' with its 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, }, ], }; } );
  • The input schema definition using Zod's z.string() for the tool's single string parameter.
    { input: z.string().describe("Input parameter for the sample tool"), },

Other Tools

Related 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