diff --git a/src/apis/hello.ts b/src/apis/hello.ts new file mode 100644 index 0000000..73364c5 --- /dev/null +++ b/src/apis/hello.ts @@ -0,0 +1,35 @@ +import { ApiFactory, InferSchema } from '@tigerdata/mcp-boilerplate'; +import { z } from 'zod'; +import { ServerContext } from '../types.js'; + +const inputSchema = { + name: z.string().optional().describe('Optional name to greet.'), +} as const; + +const outputSchema = { + message: z.string().describe('The hello world greeting message.'), +} as const; + +export const helloFactory: ApiFactory< + ServerContext, + typeof inputSchema, + typeof outputSchema +> = () => ({ + name: 'hello', + method: 'get', + route: '/hello', + config: { + title: 'Hello World', + description: + 'A simple hello world endpoint that returns a greeting message.', + inputSchema, + outputSchema, + }, + fn: async ({ name }): Promise> => { + const greeting = name ? `Hello, ${name}!` : 'Hello, World!'; + + return { + message: greeting, + }; + }, +}); diff --git a/src/apis/index.ts b/src/apis/index.ts index b17b9e1..b82699d 100644 --- a/src/apis/index.ts +++ b/src/apis/index.ts @@ -1,9 +1,11 @@ import { forgetFactory } from './forget.js'; +import { helloFactory } from './hello.js'; import { recallFactory } from './recall.js'; import { rememberFactory } from './remember.js'; import { updateFactory } from './update.js'; export const apiFactories = [ + helloFactory, rememberFactory, updateFactory, forgetFactory,