跳到正文
DEV Community· Botopia Es·· 4 小時前AI 評分47

MCP 工具變更後,應重新測試哪些內容?

When an MCP tool changes, what should you test again?

AI 導讀

MCP 工具的描述符或合約變更後,應重新檢查輸入要求、權限、實際回應,以及用戶介面的輸出和失敗處理。DraftYourApp 的 MCP 流程會連接伺服器檢視工具,但不會執行工具;遠端測試則是另一項明確操作。指南要求在描述符變更或測試收據過期時再次檢視和測試,並將測試證據與所驗證的合約一併保存。

正文

Disclosure: this article was prepared with AI assistance for DraftYourApp. This walkthrough uses a hypothetical example to explain a review process; it does not report a customer incident or a live test.

A successful tool call answers a narrow question: did this operation work with these inputs, permissions and conditions? When the contract changes, the old result may no longer answer the question you have today.

Consider a synthetic order-status tool. Yesterday its input was an order reference. Today the descriptor requires both an order reference and a region. A button can still look correct while sending yesterday’s arguments.

1. Keep a record of what was reviewed

Record the tool name, description, input contract, relevant output expectations and annotations alongside the test inputs. Keep credentials and personal data out of the record.

For this example, use a clearly fictional order reference such as DEMO-ORDER-001. Do not send that reference to an arbitrary production server: use a controlled test environment where its meaning and permitted effects are known.

2. Inspect the current contract

Compare the current descriptor with the reviewed version. Which input became required? Did the meaning of a field change? Does the tool still perform the same task?

Treat the comparison as a review aid. A textual difference does not, by itself, tell you whether a change is harmless or compatible with your application.

In DraftYourApp’s documented MCP flow, inspection contacts the server and lists tools without executing them. The subsequent remote test is a separate, explicit action. Discovery is still a network interaction; it is not an offline check.

3. Check permissions before running anything

Confirm the destination, the scope of the operation and the arguments you are authorized to send. A tool test may affect real data. Do not remove authentication or broaden permissions simply to turn a failing test green.

If the tool list depends on authentication state, compare like with like. A difference between an authenticated and an unauthenticated session is not sufficient evidence that a deployment changed.

4. Repeat the relevant test

For the fictional order-status example, update the arguments to include the region defined by your controlled fixture. Record the actual response and compare it with the expected outcome. Also check the intended behavior when a required field is missing or the order does not exist in that fixture.

Do not label these cases “passed” until they have actually been exercised. A written expected result is a test plan, not a receipt.

DraftYourApp’s guide calls for inspection and testing again when descriptors change or a test receipt expires. Keep the evidence associated with the contract it tested.

5. Check the user-facing task

Once the selected operation is reviewed, check how the interface handles its output and failure states. A local preview, a remote operation test and a check in the intended client each answer different questions.

For the order example, can the user understand which order was found, which region was used and what to do if no result is available? A successful response alone does not establish that the whole interaction is useful.

Start with one task and one observable result. Expand only when the evidence supports it.

DraftYourApp’s MCP connection guide

來源:DEV Community · dev.to