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

# TypeScript SDK

> Register tools with the TypeScript SDK

The TypeScript SDK provides a simple way to register functions as tools for AI agents.

## Installation

```bash theme={null}
npm install agentrpc
```

## Basic Usage

```ts theme={null}
import { AgentRPC } from 'agentrpc';
import { z } from 'zod';

const rpc = new AgentRPC({
  apiSecret: process.env.AGENTRPC_API_SECRET!,
});

rpc.register({
  name: 'getWeather',
  description: 'Return weather information at a given location',
  schema: z.object({ location: z.string() }),
  handler: async ({ location }) => {
    return {
      location: location,
      temperature: 'variable',
      parcipitation: 'probably',
    };
  },
});

rpc.listen();

```

## MCP Server

The TypeScript SDK includes an MCP (Model Context Protocol) server that can be started using:

```bash theme={null}
AGENTRPC_API_SECRET <YOUR_API_SECRET> npx agentrpc mcp
```

For more details, visit the [TypeScript SDK GitHub repository](https://github.com/agentrpc/agentrpc/tree/main/sdk-node).
