Skip to content

Commit 150083c

Browse files
committed
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](modelcontextprotocol/inspector#154) (yet), string may be more stable at the current.
1 parent e1ee576 commit 150083c

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

‎src/index.ts‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,26 @@ server.tool(
123123
"get_post",
124124
"Get post from DocBase",
125125
{
126-
id: z.number().int().describe("Post ID"),
126+
id: z.string().describe("Post ID"),
127127
},
128128
async ({ id }) => {
129+
if (!/^\d+$/.test(id)) {
130+
const errorText = `${id} is not post ID`;
131+
console.error(errorText);
132+
return {
133+
content: [
134+
{
135+
type: "text",
136+
text: errorText,
137+
},
138+
],
139+
isError: true,
140+
};
141+
}
142+
129143
const client = new DocBaseClient({ domain, accessToken });
130-
const { data, error, response } = await client.getPost(id);
144+
const numberId = parseInt(id, 10)
145+
const { data, error, response } = await client.getPost(numberId);
131146

132147
if (error) {
133148
console.error(error);

0 commit comments

Comments
 (0)