Choose the right mechanism
Do not hide a required security rule only in prose. Authentication, authorization, validation, and confirmation must be enforced by code.
Write precise tool descriptions
A strong tool description explains:- The exact task
- When to use the tool
- When not to use it
- Important side effects
- How it differs from similar tools
Manage customer orders.Better:
Retrieves one order by its exactUse stable, action-oriented names such asord_identifier. Usesearch_orderswhen the identifier is unknown. This tool does not modify the order.
get_order, search_orders, and cancel_order. Avoid multiple tools with nearly identical descriptions.
Make schemas do the hard work
Descriptions guide selection. JSON Schema constrains input. For every argument:- Use the correct type.
- State the format and units.
- Add meaningful field descriptions.
- Mark required values.
- Use enums for small closed sets.
- Add sensible length, range, and pattern limits.
- Avoid accepting a single free-form object when fields are known.
outputSchema when the client needs reliable fields.
Design reusable MCP prompts
MCP prompts are discoverable templates retrieved throughprompts/list and prompts/get. They are intended to be user-controlled.
A useful prompt has:
- A stable name
- A clear display title and description
- A small set of named arguments
- A focused result
- No hidden side effect
Use embedded resources deliberately
A prompt can include text, images, audio, or embedded resources supported by the protocol. Embed a resource when the workflow needs stable server-managed context, such as a support policy or code file. Keep the content relevant and bounded. Authorize the resource before including it. Treat embedded and retrieved content as untrusted. It may contain prompt injection.Keep instructions short and scoped
Server instructions should explain broad behavior that applies across the server:- The server’s domain
- Important tool-selection rules
- Required confirmation patterns
- Known limitations
Design for safe model behavior
- Label write and destructive actions clearly.
- Require confirmation in the host or server for high-impact operations.
- Use least privilege for upstream credentials.
- Validate the final arguments independently of the conversation.
- Treat tool descriptions and annotations from untrusted servers as untrusted.
- Never include credentials in prompts, descriptions, or examples.
- Do not let retrieved text override authorization policy.
Test prompting with evaluations
Create a test set containing:- Clear requests for each tool
- Ambiguous requests
- Requests that should use a similar tool
- Requests that should not call any tool
- Missing or malformed arguments
- Prompt-injection attempts
- Read and write variants of the same task
Improve descriptions systematically
When a model chooses the wrong tool:- Save the failing request as a test case.
- Identify the overlapping or missing wording.
- Change one name, description, or schema constraint.
- Rerun the full evaluation set.
- Publish the change as a reviewed version.
Create prompts in 0mcp
0mcp lets you add reusable prompts to hosted MCP servers created from OpenAPI, Swagger, direct REST API, or GraphQL sources. Use Prompts to define the template and inputs. Test prompt discovery and generated messages in the Playground before publishing a new version.Checklist
- Each tool has one distinct purpose
- Descriptions explain when to use and avoid a tool
- Schemas constrain known inputs
- Write and destructive effects are explicit
- MCP prompts are user-controlled and argument-driven
- Embedded resources are authorized and bounded
- Security rules are enforced in code
- Evaluation tests cover positive, negative, and adversarial cases
- Prompt changes are versioned and reviewed