Skip to content

Quickstart — Claude tool-use

Anthropic's tool-use API expects an array of tool descriptors. We publish them at /.well-known/mcp.json; you can import them directly or paste the relevant ones.

1. Self-onboard your agent

curl -X POST https://api.gridrock.ai/oauth/register \
  -H 'Content-Type: application/json' \
  -d '{"client_name":"my-claude-agent","scope":"read:geo read:hex read:env"}'

You get back client_id + client_secret. Store securely.

2. Exchange for a token

curl -X POST https://api.gridrock.ai/oauth/token \
  -d 'grant_type=client_credentials&client_id=...&client_secret=...&scope=read:geo'

3. Bind a tool to Claude

import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic();

const tools = [{
  name: 'geo_reverse',
  description: 'Reverse-geocode an Indian coordinate to ward + pincode + city.',
  input_schema: {
    type: 'object',
    properties: { lat: { type: 'number' }, lng: { type: 'number' } },
    required: ['lat', 'lng'],
  },
}];

const msg = await client.messages.create({
  model: 'claude-sonnet-4-5',
  tools,
  messages: [{ role: 'user', content: 'Where is 19.0760, 72.8777?' }],
});

When Claude calls the tool, you forward to GridRock with the agent token, and pass the response straight back.