Tool customization
Tool customization, also known as tool hardening, is an MCP Gateway feature that lets you create hardened variants of existing tools with fixed input values, rewritten descriptions, or both. Tool hardening constrains what an MCP tool can do at the gateway layer, before agents call it. These customized tools appear alongside the original tool and can enforce constraints, improve security, and guide AI agents toward the correct tool behavior.
Why tool customization matters
When AI agents call tools, unrestricted flexibility opens the door to indirect prompt injection, tool poisoning, and excessive agency. Indirect prompt injection hides malicious instructions in tool descriptions, while tool poisoning tampers with tool metadata. Tool customization mitigates these risks through hardening:
- Security hardening: Lock or override parameter values.
- Clarity for models: Rewrite or append tool and parameter descriptions.
- Governance and compliance: Maintain an approved catalog of hardened tools aligned with internal policies.
- Operational consistency: Ensure every customized tool behaves predictably across agents and workflows.
Common use cases
- Enforce fixed parameters. For example, always use a specific timezone or endpoint.
- Add or rewrite tool descriptions to reflect security or compliance rules.
- Expose only hardened tool variants to agents using Agent access control.
- Help LLMs choose the right tool by making descriptions clear, contextual, and policy-aware.
- Create a variant that enforces secure actions, such as always setting a GitHub repository to private.
Configuration
You can create a custom tool within the MCP Gateway's control plane user interface.
- In the MCP Gateway control plane user interface, go to Tools.
- Select an existing tool from one of your connected servers.
- Click Customize.
- Select the input you wish to harden, such as:
- Parameter Value
- Tool Description
- Parameter Description
- Click Save.
MCP Gateway adds your custom tool to the list of tools for the connected server and updates app.yaml accordingly.
Say that you want to create a new tool called Custom_add_issue_comment_private_repo. This tool overrides the repo parameter to always use my-public-repo. It also updates the tool description to append the sentence Only add comments to private GitHub repositories.. Use the following configuration to fulfill this scenario.
toolExtensions:
services:
github:
add_issue_comment:
childTools:
- name: Custom_add_issue_comment_private_repo
description:
action: rewrite
text: Add a comment to a specific issue in my-public-repo GitHub repository.
Use this tool to add comments to pull requests as well (in this case pass pull
request number as issue_number), but only if user is not asking specifically
to add review comments.
overrideParams:
repo:
value: my-public-repo
description:
action: rewrite
text: Repository name
Description customization
Tool and parameter descriptions give LLMs the context they need to use a tool effectively. Clear and custom descriptions allow for correct, context-aware tool use. When you customize a description, you can either rewrite it completely by replacing the existing tool or parameter description, or append text to it.
Given the original tool description:
Add a comment to a specific issue in my-public-repo GitHub repository. Use this tool to add comments to pull requests as well (in this case pass pull request number as issue_number), but only if user is not asking specifically to add review comments.
Use rewrite or append to specify what the new, custom tool should do.
Rewrite example
description:
action: rewrite
text: "Add a comment to a specific issue in my-public-repo GitHub repository. Use this tool to add
comments to pull requests as well (in this case pass pull request number as issue_number),
but only if user is not asking specifically to add review comments."
This replaces the tool's description entirely with the text you provide.
Append example
To append to the description, add the content you want to appear after the default description, as shown in the following example.
description:
action: append
text: "Only add comments to the Github repository my-public-repo."
This appends your new text to the end of the original description, creating an updated description.
Add a comment to a specific issue in a GitHub repository. Use this tool to add comments to pull requests as well (in this case pass pull request number as issue_number), but only if user is not asking specifically to add review comments. Only add comments to the Github repository my-public-repo.
Append lets you add customization to descriptions even if the original description changes. For example, if GitHub changes the description of the tool above, but you want the model to always add comments only to my-public-repo, use append. The original part of the description stays flexible, but you control what you add.
Currently, you must append a description manually, either by editing app.yaml directly or through the YAML configuration editor in the MCP Gateway control plane user interface.
Parameter overrides
Use overrideParams to lock specific inputs:
overrideParams:
repo:
value: my-public-repo
description:
action: rewrite
text: Repository name
When set, MCP Gateway always uses the stated value, even if you provide other values.