mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-02-19 11:54:58 -05:00
[WIP] Refactor everything server to be more modular and use recommended APIs.
* Ran prettier
This commit is contained in:
@@ -2,7 +2,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import { registerSimplePrompt } from "./simple.js";
|
||||
import { registerComplexPrompt } from "./complex.js";
|
||||
import { registerPromptWithCompletions } from "./completions.js";
|
||||
import { registerEmbeddedResourcePrompt } from "./resource.js"
|
||||
import { registerEmbeddedResourcePrompt } from "./resource.js";
|
||||
|
||||
/**
|
||||
* Register the prompts with the MCP server.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import {textResource, textResourceUri} from "../resources/template.js";
|
||||
import { textResource, textResourceUri } from "../resources/template.js";
|
||||
|
||||
export const registerEmbeddedResourcePrompt = (server: McpServer) => {
|
||||
// NOTE: Currently, prompt arguments can only be strings since type is not field of PromptArgument
|
||||
@@ -18,7 +18,7 @@ export const registerEmbeddedResourcePrompt = (server: McpServer) => {
|
||||
argsSchema: promptArgsSchema,
|
||||
},
|
||||
(args) => {
|
||||
const resourceId = Number(args?.resourceId); // Inspector sends strings only
|
||||
const resourceId = Number(args?.resourceId);
|
||||
if (!Number.isFinite(resourceId) || !Number.isInteger(resourceId)) {
|
||||
throw new Error(
|
||||
`Invalid resourceId: ${args?.resourceId}. Must be a finite integer.`
|
||||
|
||||
Reference in New Issue
Block a user