Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/apis/hello.ts
Original file line number Diff line number Diff line change
@@ -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.'),

Check failure on line 6 in src/apis/hello.ts

View workflow job for this annotation

GitHub Actions / lint

Avoid using .optional(), .default(), or .nullish() on zod schemas in inputSchema. Some LLMs (like GPT-5) require all tool parameters to be marked as required, and tools become unusable otherwise. Use .nullable() instead if you need to accept null values, or handle empty/missing values in your function implementation
} 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<InferSchema<typeof outputSchema>> => {
const greeting = name ? `Hello, ${name}!` : 'Hello, World!';

return {
message: greeting,
};
},
});
2 changes: 2 additions & 0 deletions src/apis/index.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Loading