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/jsonResponse Properties:
message: A welcome message.
Example:
{
"message": "Hello, world!"
}
422: Validation Error
Content-Type:
application/jsonResponse Properties:
Example:
{
"detail": [
"unknown_type"
]
}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The 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
- mcp_tools/main.py:15-16 (handler)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}!"}
- mcp_tools/main.py:12-14 (registration)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 )
- mcp_tools/schemas.py:8-11 (schema)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"] )
- mcp_tools/schemas.py:4-5 (schema)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!"])
- mcp_tools/main_http.py:19-20 (handler)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}!"}