> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/technical-reference/models-agents-and-skills/tool-selection-and-argument-validation.md).

# Tool Selection and Argument Validation

An agent chooses tools from the operations made available to it. Clear instructions and valid parameter schemas help it select the right operation and supply usable arguments.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FI8Qw17BPz60mGQTpWW9n%2FG014.mp4?alt=media&token=bd21bc90-635e-46d6-921a-b894e5e7fcb9>" %}

## Before you begin

A tool-enabled model, selected tools, and permission to use their connections.

## Key concepts

| Term          | Definition                                                                                                                                                  |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Tool          | An operation that an agent or workflow can call. Its input schema and permissions determine what the caller can supply and do.                              |
| Tool argument | A value supplied when calling a tool. It must match that tool’s exposed input schema and refer to accessible resources.                                     |
| Schema        | A definition of fields, types, required values, and supported constraints. Use it to validate the shape of data; it does not establish factual correctness. |
| Connection    | A saved authorization to a particular provider account. An action uses the selected account’s access, subject to StackAI sharing controls.                  |
| Instructions  | Directions that define the task, constraints, and expected response. Keep them distinct from source text or tool results used as evidence.                  |

## Configure tool inputs

1. Add the required tools and review each tool’s description and schema.

![Use Add Tools to choose the required provider action.](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/80OYNOlyoCVZ1nLoCugC/assets/g014-g014-02-tool-library.png)

Use Add Tools to choose the required provider action.

2. Explain when the agent should call each tool and what evidence it must return.
3. Inspect a run’s tool calls, arguments, and results before changing the instructions.

The agent calls the intended operation with values that match its schema.

## Behavior and limitations

Making a tool available does not guarantee a call. Required configuration can be separate from model-supplied arguments. A tool-selection problem differs from a permission failure or an invalid argument. Correct the failing layer rather than repeatedly rewriting the prompt.

## Related resources

[Give an agent tools](/guides-and-quickstarts/agent-builder-and-skills/give-an-agent-tools.md)

[Model Settings and Supported Capabilities](/technical-reference/models-agents-and-skills/model-settings-and-supported-capabilities.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/technical-reference/models-agents-and-skills/tool-selection-and-argument-validation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
