How do you handle MCP tool errors?
Return structured, actionable errors that distinguish invalid input, authorization failure, temporary outage, and permanent failure.
The question library
Explore practical questions, clear explanations, and code examples across developer technologies.
Showing 181–192 of 3610 questions
Return structured, actionable errors that distinguish invalid input, authorization failure, temporary outage, and permanent failure.
Indirect prompt injection occurs when retrieved documents contain instructions designed to manipulate the model, even though the user did not type them.
Use layered defenses: separate instructions from untrusted content, minimize tool permissions, validate arguments, enforce policy in deterministic code, and require approval for sensitive actions.
Data exfiltration occurs when an assistant or tool sends confidential information to an unauthorized destination.
Secrets should remain in a secret store or trusted backend and should not be placed in prompts, retrieved documents, model-visible logs, or client code unless strictly necessary.
Excessive agency occurs when an AI system has more tools or authority than needed for its task.
An evaluation dataset contains representative inputs, expected outcomes or grading criteria, and metadata needed to measure application behavior.
A golden test set is a curated set of inputs and expected answers or rubric judgments used to detect regressions.
Faithfulness evaluation checks whether claims in the generated answer are supported by the retrieved context.
Pairwise evaluation compares two candidate outputs for the same input and asks a human or judge model which better satisfies a rubric.
Use semantic rubrics, structural assertions, bounded numeric tolerances, and repeated trials rather than requiring exact string matches for every task.
Useful telemetry includes request ID, model and prompt version, latency, token counts, retrieval sources, tool names, outcome, and error category.