mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-18 00:03:23 +02:00
[WIP] Refactor everything server to be more modular and use recommended APIs.
* Updated architecture.md * Refactor / renamed all addXPrompt, addXTool, and addXResource functions to registerX... * Added the add tool
This commit is contained in:
@@ -2,7 +2,7 @@ import { z } from "zod";
|
||||
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import { completable } from "@modelcontextprotocol/sdk/server/completable.js";
|
||||
|
||||
export const addPromptWithCompletions = (server: McpServer) => {
|
||||
export const registerPromptWithCompletions = (server: McpServer) => {
|
||||
const promptArgsSchema = {
|
||||
department: completable(z.string(), (value) => {
|
||||
return ["Engineering", "Sales", "Marketing", "Support"].filter((d) =>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod";
|
||||
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
|
||||
export const addComplexPrompt = (server: McpServer) => {
|
||||
export const registerComplexPrompt = (server: McpServer) => {
|
||||
const promptArgsSchema = {
|
||||
city: z.string().describe("Name of the city"),
|
||||
state: z.string().describe("Name of the state").optional(),
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import { addSimplePrompt } from "./simple.js";
|
||||
import { addComplexPrompt } from "./complex.js";
|
||||
import { addPromptWithCompletions } from "./completions.js";
|
||||
import { registerSimplePrompt } from "./simple.js";
|
||||
import { registerComplexPrompt } from "./complex.js";
|
||||
import { registerPromptWithCompletions } from "./completions.js";
|
||||
|
||||
/**
|
||||
* Register the prompts with the MCP server.
|
||||
* @param server
|
||||
*/
|
||||
export const registerPrompts = (server: McpServer) => {
|
||||
addSimplePrompt(server);
|
||||
addComplexPrompt(server);
|
||||
addPromptWithCompletions(server);
|
||||
registerSimplePrompt(server);
|
||||
registerComplexPrompt(server);
|
||||
registerPromptWithCompletions(server);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
|
||||
export const addSimplePrompt = (server: McpServer) => {
|
||||
export const registerSimplePrompt = (server: McpServer) => {
|
||||
server.registerPrompt(
|
||||
"simple-prompt",
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user