From 150083c690ee67e41b7e6359112cd7496ed0b831 Mon Sep 17 00:00:00 2001 From: alpaca-tc Date: Tue, 25 Mar 2025 23:22:41 +0900 Subject: [PATCH] For Cursor, id is defined as string, not integer Cursor tries to pass the id as a string, so it seems that it cannot be used in an integer definition. Since [inspector does not support integer](https://github.com/modelcontextprotocol/inspector/issues/154) (yet), string may be more stable at the current. --- src/index.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 4093f87..3437322 100644 --- a/src/index.ts +++ b/src/index.ts @@ -123,11 +123,26 @@ server.tool( "get_post", "Get post from DocBase", { - id: z.number().int().describe("Post ID"), + id: z.string().describe("Post ID"), }, async ({ id }) => { + if (!/^\d+$/.test(id)) { + const errorText = `${id} is not post ID`; + console.error(errorText); + return { + content: [ + { + type: "text", + text: errorText, + }, + ], + isError: true, + }; + } + const client = new DocBaseClient({ domain, accessToken }); - const { data, error, response } = await client.getPost(id); + const numberId = parseInt(id, 10) + const { data, error, response } = await client.getPost(numberId); if (error) { console.error(error);