Skip to content

Parameter Mapping

When integrating HTTP API data sources into your MCP server, it’s essential to define how the parameters in your tool map to the variables used in the API requests. In Infragate, when you create a tool that interacts with an HTTP API, you can specify parameters that the AI model can use when invoking the tool. These parameters are then mapped to the corresponding parts of the API request, such as path parameters, query parameters, or request body fields.

When defining parameters for an HTTP API tool, you can specify various types, including:

  • String: Represents text data.
  • Number: Represents numerical data.
  • Boolean: Represents true/false values.
  • Array: Represents a list of values.
  • Object: Represents a structured data type with key-value pairs.

If your API endpoint includes route parameters (e.g., /api/resource/:id), you can map tool parameters directly to these route parameters. For example, if you have a tool parameter named id, it will be substituted into the API endpoint when the tool is invoked.

When defining query parameters for an HTTP API tool, you can specify them separately from the endpoint URL. This allows for more flexibility and clarity in how the API is invoked.

For example, if you have a tool parameter named filter, you can define it as a query parameter like this:

Query Parameters Configuration
{
"filter": ":filter"
}

When invoked the request URL will be constructed as follows:

/api/resource/{value}?filter={value}

If your API endpoint requires a request body (e.g., for POST or PUT requests), you can map tool parameters to the fields in the request body.

Request Body Configuration
{
"name": ":name",
"age": ":age"
}

You can also map tool parameters to HTTP request headers if your API requires specific headers to be set.

Request Headers Configuration
{
"Authorization": "Bearer :auth_token",
"Content-Type": "application/json"
}