From 9f50e138a75ff968bbecb78b547c8bdb3badbebe Mon Sep 17 00:00:00 2001 From: Younes Abouelnagah Date: Wed, 25 Nov 2026 16:34:36 -0500 Subject: [PATCH] [#442] feat(mcp): declare destructiveHint: false on answer_islamic_question OpenAI's app directory review requires readOnlyHint, destructiveHint and openWorldHint to be explicit on every tool. The tool only asks Ansari a question and returns its answer, so it destroys nothing. Name, title, description, input, the other hints and the card resource are unchanged. ansari-mcp 0.17.3, so /health shows when the change is live. Co-Authored-By: Claude Opus 5.5 --- apps/mcp/README.md | 2 +- apps/mcp/package.json | 2 +- apps/mcp/src/server/create-server.ts | 4 ++-- apps/mcp/src/version.ts | 2 +- apps/mcp/test/parity-cases.ts | 2 +- apps/mcp/test/request-contract.test.ts | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/mcp/README.md b/apps/mcp/README.md index 2fd5cda5..68861803 100644 --- a/apps/mcp/README.md +++ b/apps/mcp/README.md @@ -244,7 +244,7 @@ Hono runs on Node through `@hono/node-server`; the official `@modelcontextprotoc ## MCP compatibility -The tool retains the legacy server's `answer_islamic_question` name, detailed description and input help, and `readOnlyHint: true` / `openWorldHint: true` annotations. It accepts 1–4,000 characters, matching the Ansari API. The earlier experimental RC exposed `ask_ansari`; a deployment owner must refresh host discovery when adopting this tool name. The endpoint remains `/mcp`. Replacing the existing `mcp.ansari.chat` service and changing its DNS are separate rollout actions. +The tool retains the legacy server's `answer_islamic_question` name, detailed description and input help, and `readOnlyHint: true` / `openWorldHint: true` annotations, plus an explicit `destructiveHint: false`, which OpenAI's app directory requires (#442). It accepts 1–4,000 characters, matching the Ansari API. The earlier experimental RC exposed `ask_ansari`; a deployment owner must refresh host discovery when adopting this tool name. The endpoint remains `/mcp`. Replacing the existing `mcp.ansari.chat` service and changing its DNS are separate rollout actions. ### "Unable to reach" after a deploy diff --git a/apps/mcp/package.json b/apps/mcp/package.json index 45a51da7..8360b30c 100644 --- a/apps/mcp/package.json +++ b/apps/mcp/package.json @@ -1,6 +1,6 @@ { "name": "ansari-mcp", - "version": "0.17.2", + "version": "0.17.3", "private": true, "type": "module", "description": "Ansari's MCP application", diff --git a/apps/mcp/src/server/create-server.ts b/apps/mcp/src/server/create-server.ts index 371e1d67..9b9384c4 100644 --- a/apps/mcp/src/server/create-server.ts +++ b/apps/mcp/src/server/create-server.ts @@ -28,8 +28,8 @@ export function createAnsariMcpServer(options:CreateMcpServerOptions):McpServer{ name:'answer_islamic_question', title:'Answer Islamic Question', description:'Answers questions about Islam including theology, jurisprudence (fiqh), history, Quranic interpretation (tafsir), Hadith sciences, Islamic law, worship practices, ethics, spirituality, and contemporary issues. Provides comprehensive answers with citations from Quran, authentic Hadith, and classical Islamic scholarship. Can handle questions about specific verses, hadiths, scholarly opinions, historical events, prophets, companions, and modern applications of Islamic principles.', - // Preserve the legacy discovery contract; read-only tools need no destructive/idempotent hints. - annotations:{readOnlyHint:true,openWorldHint:true}, + // The legacy discovery hints, plus an explicit destructiveHint, which OpenAI's directory review requires (#442). + annotations:{readOnlyHint:true,destructiveHint:false,openWorldHint:true}, // Application handler bound, with a fresh lifetime per call. boundMs:HANDLER_BOUND_MS, input:z.object({question:z.string().min(1).max(4000).describe('The question about Islam to be answered. Include as much context and detail as possible. You can ask about specific Quranic verses, hadiths, Islamic rulings, historical events, theological concepts, or practical applications. The more context provided, the more comprehensive and relevant the answer will be.')}), diff --git a/apps/mcp/src/version.ts b/apps/mcp/src/version.ts index 02adf4c0..14632ded 100644 --- a/apps/mcp/src/version.ts +++ b/apps/mcp/src/version.ts @@ -1,2 +1,2 @@ // One application identity, shared by the server and built view. -export const APP_VERSION = '0.17.2'; +export const APP_VERSION = '0.17.3'; diff --git a/apps/mcp/test/parity-cases.ts b/apps/mcp/test/parity-cases.ts index 8dfde0b5..620cfa6d 100644 --- a/apps/mcp/test/parity-cases.ts +++ b/apps/mcp/test/parity-cases.ts @@ -110,7 +110,7 @@ export function defineParityCases(kind: RuntimeKind): void { assert.deepEqual(tools.map(tool => tool.name), ['answer_islamic_question']); assert.equal(tools[0].annotations?.readOnlyHint, true); assert.equal(tools[0].annotations?.openWorldHint, true); - assert.equal(tools[0].annotations?.destructiveHint, undefined); + assert.equal(tools[0].annotations?.destructiveHint, false); assert.equal(tools[0].annotations?.idempotentHint, undefined); const before = upstream.seen.length; const question = `complete ${kind} ${mode}`; diff --git a/apps/mcp/test/request-contract.test.ts b/apps/mcp/test/request-contract.test.ts index 76b6f195..a3bff473 100644 --- a/apps/mcp/test/request-contract.test.ts +++ b/apps/mcp/test/request-contract.test.ts @@ -25,7 +25,7 @@ test('legacy discovery and question bounds are enforced before upstream work', a assert.equal(tools[0].description, legacyDescription); assert.equal(tools[0].annotations?.readOnlyHint, true); assert.equal(tools[0].annotations?.openWorldHint, true); - assert.equal(tools[0].annotations?.destructiveHint, undefined); + assert.equal(tools[0].annotations?.destructiveHint, false); assert.equal(tools[0].annotations?.idempotentHint, undefined); for (const question of ['', 'x'.repeat(4001)]) { const result = await client.callTool({name: toolName, arguments: {question}}).then(