> 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/apis-and-mcp/mcp-tool-discovery-schemas-and-errors.md).

# MCP Tool Discovery, Schemas, and Errors

MCP discovery returns tool names, descriptions, and input schemas. Use those schemas to construct calls and inspect the tool result for errors.

![Discover the tools available to this session](https://1957915746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2Fo4oRlUL5VhjPxwMa4dXl%2Fmcp-tool-discovery-schemas-and-errors.png?alt=media)

After initialization and authentication, inspect each returned tool’s name, description, and inputSchema. Follow nextCursor if returned. For a call, check both protocol errors and the tool result’s isError field.

<details>

<summary>Copy the example</summary>

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list",
  "params": {}
}
```

</details>

## Before you begin

An authenticated MCP connection.

## Key concepts

| Term           | Definition                                                                                                                                                  |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Tool discovery | Retrieval of the available tool names, descriptions, and input schemas. Use the current discovered schema instead of guessing an operation name.            |
| 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. |
| Tool result    | The returned data or error from a tool operation. The agent should base its report on this result rather than assuming the call succeeded.                  |
| HTTP status    | The numeric outcome returned for an HTTP request. Read the response body too; accepted work can still be running.                                           |

## Discover and call an MCP tool

1. List the tools exposed by the connected server.
2. Choose the operation and provide fields matching its input schema.
3. Inspect the returned content and error indicator before using its result in another step.

The client calls an available tool with valid arguments and handles its outcome.

## Behavior and limitations

Transport success does not guarantee tool success. Required fields and names can differ from a similar REST endpoint. Refresh discovery after server changes. Do not invent tools from product labels or call tools absent from the authenticated catalog.

## Related resources

[API Versions and Compatibility](https://docs.stackai.com/technical-reference/apis-and-mcp/api-versions-and-compatibility.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/apis-and-mcp/mcp-tool-discovery-schemas-and-errors.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.
