Skip to main content
Glama
hsiangjenli
by hsiangjenli

new_endpoint

Generate a personalized welcome message by providing a name. This tool returns a JSON response with a greeting message or validation error details.

Instructions

New Endpoint

Responses:

  • 200 (Success): Successful Response

    • Content-Type: application/json

    • Response Properties:

      • message: A welcome message.

    • Example:

{ "message": "Hello, world!" }
  • 422: Validation Error

    • Content-Type: application/json

    • Response Properties:

    • Example:

{ "detail": [ "unknown_type" ] }

Input Schema

NameRequiredDescriptionDefault
nameYesThe name to include in the message.

Input Schema (JSON Schema)

{ "properties": { "name": { "description": "The name to include in the message.", "examples": [ "developer" ], "title": "Name", "type": "string" } }, "required": [ "name" ], "type": "object" }

Implementation Reference

  • The handler function for the "new_endpoint" MCP tool. It receives a NewEndpointRequest with a 'name' field and returns a greeting message in NewEndpointResponse format.
    async def new_endpoint(request: NewEndpointRequest): return {"message": f"Hello, {request.name}!"}
  • FastAPI route decorator that registers the new_endpoint handler as an MCP tool using operation_id="new_endpoint". FastMCP.from_fastapi will expose this as an MCP tool.
    @app.post( "/new/endpoint/", operation_id="new_endpoint", response_model=NewEndpointResponse )
  • Pydantic input schema (NewEndpointRequest) for the new_endpoint tool, defining the 'name' parameter.
    class NewEndpointRequest(BaseModel): name: str = Field( ..., description="The name to include in the message.", examples=["developer"] )
  • Pydantic output schema (NewEndpointResponse) for the new_endpoint tool, defining the 'message' response.
    class NewEndpointResponse(BaseModel): message: str = Field(..., description="A welcome message.", examples=["Hello, world!"])
  • Identical handler function for the "new_endpoint" tool in the HTTP-optimized main file.
    async def new_endpoint(request: NewEndpointRequest): return {"message": f"Hello, {request.name}!"}

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/hsiangjenli/mcp-slidev'

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