Skip to content

Commit b507c3d

Browse files
committed
feat: integrate fetch example tools into MCP server
- Register fetch_example and configure_fetch tools in server - Update tool exports and imports for new fetch functionality - Maintain backward compatibility with existing example tool - Total of 3 tools now available in MCP server interface
1 parent a102800 commit b507c3d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/index.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprot
1010
import { zodToJsonSchema } from 'zod-to-json-schema';
1111
import { createCLI } from './cli.js';
1212
import { ExampleToolSchema, exampleTool } from './tools/example.js';
13+
import {
14+
ConfigureFetchSchema,
15+
FetchExampleSchema,
16+
configureFetchTool,
17+
fetchExampleTool,
18+
} from './tools/fetch-example.js';
1319

1420
/**
1521
* Determine if we're running in CLI mode
@@ -64,6 +70,18 @@ export async function startMcpServer() {
6470
description: 'An example tool that echoes back the input',
6571
inputSchema: zodToJsonSchema(ExampleToolSchema),
6672
},
73+
{
74+
name: 'fetch_example',
75+
description:
76+
'Demonstrate configurable fetch patterns with different backends and caching',
77+
inputSchema: zodToJsonSchema(FetchExampleSchema),
78+
},
79+
{
80+
name: 'configure_fetch',
81+
description:
82+
'Configure the global fetch instance settings and caching behavior',
83+
inputSchema: zodToJsonSchema(ConfigureFetchSchema),
84+
},
6785
],
6886
};
6987
});
@@ -79,6 +97,10 @@ export async function startMcpServer() {
7997
switch (name) {
8098
case 'example_tool':
8199
return await exampleTool(args);
100+
case 'fetch_example':
101+
return await fetchExampleTool(args);
102+
case 'configure_fetch':
103+
return await configureFetchTool(args);
82104
default:
83105
throw new Error(`Unknown tool: ${name}`);
84106
}

0 commit comments

Comments
 (0)