> ## Documentation Index
> Fetch the complete documentation index at: https://aixyz.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# tools/[name].ts

> Auto-discovered tool definitions for A2A and MCP

Each `.ts` file in `app/tools/` is auto-discovered and registered as a tool on both A2A and MCP endpoints.

```typescript title="app/tools/weather.ts" theme={null}
import { tool } from "ai";
import { z } from "zod";
import type { Accepts } from "aixyz/accepts";

export const accepts: Accepts = {
  scheme: "exact",
  price: "$0.0001",
};

export default tool({
  description: "Get current weather conditions for a city.",
  inputSchema: z.object({
    location: z.string().describe("City name"),
  }),
  execute: async ({ location }) => {
    // your implementation
  },
});
```

## Exports

| Export    | Type      | Required | Description                                                                                                                                  |
| --------- | --------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `default` | `tool()`  | Yes      | The tool instance                                                                                                                            |
| `accepts` | `Accepts` | No       | Payment config — gates the tool on MCP `/mcp`. Supports [array format](/getting-started/payments#multiple-payment-options) for multi-network |

## Conventions

* **Auto-discovered** — All `.ts` files in `app/tools/` are registered automatically
* **Ignored files** — Files starting with `_` (e.g., `_helpers.ts`) are skipped
* **Naming** — The tool is registered with the filename as its name (e.g., `weather.ts` → `weather`)
