kirha logo

Tools API Quickstart

What is the Tools API

The Tools API is the catalogue of KIRHA's data provider tools. You can browse it, rank it against an intent written in plain language, read a single tool, and run one with the parameters you choose. It skips the planner: you decide which provider is called and how.

Use the Tools API when you:

  • Already know which tool and parameters you need
  • Want to skip the planning step for your own orchestration logic
  • Need to call a single provider in isolation

Browsing, matching and reading tools is free. Only execution spends credits.

Prefer Search API for most use cases

If you have a question in plain language and want KIRHA to pick the right tools, run them and answer, use the Search API instead.

Authentication

All Tools API requests need an API key. Create one at app.kirha.com/api-keys.

Pass it when you create the client:

import { Kirha } from "kirha";

const kirha = new Kirha({ apiKey: process.env.KIRHA_API_KEY });

Send it in the Authorization header. The Bearer prefix is optional:

Authorization: Bearer <your_api_key>

The client reads it from the KIRHA_API_KEY environment variable:

from kirha import Kirha

kirha = Kirha()

Find the tool for an intent

Describe what you want to do and get the tools that can do it, most relevant first. You don't need to know the catalogue:

const match = await kirha.matchTools("what is the price of a coin", { limit: 5 });

for (const tool of match.tools) {
  console.log(`${tool.name} (${tool.creditsPerCall} credits): ${tool.description}`);
}
curl -X GET "https://api.kirha.com/tools/v1/match?q=what+is+the+price+of+a+coin&focus=crypto&limit=5" \
     -H "Authorization: Bearer <your_api_key>"
match = kirha.match("what is the price of a coin", limit=5)

for tool in match.tools:
    print(f"{tool.name} ({tool.credits_per_call} credits): {tool.description}")
{
  "tools": [
    {
      "id": "648bcb56-344f-4e51-ae57-fd6aca6e4be1",
      "name": "coingecko_getCoinMarketData",
      "provider": "coingecko",
      "description": "Get market data for a single coin by its ID.",
      "credits_per_call": 1
    },
    {
      "id": "46100a94-d33f-4a7a-ba3a-d2ce548643bd",
      "name": "coingecko_searchCoin",
      "provider": "coingecko",
      "description": "Search for coins listed on CoinGecko by name or symbol.",
      "credits_per_call": 0,
      "related": true,
      "related_to": ["coingecko_getCoinMarketData"]
    }
  ],
  "total": 6,
  "limit": 5,
  "skip": 0
}

The response above is trimmed to two of its six tools, and each tool also carries its input_schema and output_schema.

A tool carrying related: true was not matched against your intent: it was pulled in because it chains with one of the tools that were, and related_to names those. Here, coingecko_searchCoin turns "avax" into a coin id and coingecko_getCoinMarketData takes that id — the pair is an execution chain you can run in order.

Related tools come on top of the limit

limit caps the direct picks only. Related tools are added to them, so a response can hold more tools than limit, and total can be larger than limit too.

List the catalogue

List every tool, or narrow the list to one vertical or one provider:

const page = await kirha.listTools({ focus: "crypto", page: 1, limit: 20 });

console.log(`${page.tools.length} of ${page.total} tools`);
curl -X GET "https://api.kirha.com/tools/v1?focus=crypto&page=1&limit=20" \
     -H "Authorization: Bearer <your_api_key>"
page = kirha.tools_page(focus="crypto", page=1, limit=20)

print(f"{len(page.tools)} of {page.total} tools")
{
  "tools": [
    {
      "id": "46100a94-d33f-4a7a-ba3a-d2ce548643bd",
      "name": "coingecko_searchCoin",
      "provider": "coingecko",
      "description": "Search for coins listed on CoinGecko by name or symbol.",
      "credits_per_call": 0,
      "input_schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "limit": { "default": 1, "maximum": 10, "minimum": 1, "type": "number" },
          "query": { "type": "string" }
        },
        "required": ["query"]
      },
      "output_schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "context": { "type": "string" },
          "coins": { "type": "array", "items": { "type": "object" } }
        },
        "required": ["context", "coins"]
      }
    }
  ],
  "total": 125,
  "limit": 20,
  "skip": 0
}

Both list routes answer the same envelope: tools holds the page, total how many tools match across every page, limit how many the page holds at most, and skip how many came before it. Page through with page and limit, or omit both to get the whole list in one answer.

Each tool names the provider that serves it and what one call costs in credits_per_call. input_schema and output_schema describe its parameters and its response — follow the input schema strictly, malformed inputs are rejected.

Browse the catalogue

Each vertical is a domain-specific collection of tools and providers. Browse them on the Providers Graph, or through the Catalogue if you are an agent.

Read one tool

Read a single tool by name, along with the other tools its provider serves:

const tool = await kirha.getTool("coingecko_searchCoin");

console.log(tool.inputSchema, tool.relatedTools);
curl -X GET "https://api.kirha.com/tools/v1/coingecko_searchCoin" \
     -H "Authorization: Bearer <your_api_key>"
tool = kirha.get("coingecko_searchCoin")

print(tool.input_schema, tool.related_tools)
{
  "id": "46100a94-d33f-4a7a-ba3a-d2ce548643bd",
  "name": "coingecko_searchCoin",
  "provider": "coingecko",
  "description": "Search for coins listed on CoinGecko by name or symbol.",
  "credits_per_call": 0,
  "input_schema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "limit": { "default": 1, "maximum": 10, "minimum": 1, "type": "number" },
      "query": { "type": "string" }
    },
    "required": ["query"]
  },
  "output_schema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "context": { "type": "string" },
      "coins": { "type": "array", "items": { "type": "object" } }
    },
    "required": ["context", "coins"]
  },
  "related_tools": [
    "coingecko_convertCurrency",
    "coingecko_getCoinHistoricalMarketData",
    "coingecko_getCoinInfo",
    "coingecko_getCoinInfoForPlatform",
    "coingecko_getCoinMarketData",
    "coingecko_getCoinOhlc",
    "coingecko_getExchangeVolumeChart",
    "coingecko_getGlobalMarketCapChart",
    "coingecko_getPublicCompanyHoldings",
    "coingecko_getTopGainersAndLosers",
    "coingecko_getTrendingCoins",
    "coingecko_getTrendingPools",
    "coingecko_searchExchange"
  ]
}

This route answers the tool on its own, not in an envelope. related_tools lists the other tools of the same provider, which is the quickest way to see what else that provider can answer.

Execute a tool

Call a tool with explicit parameters. This is the one route that spends credits:

const result = await kirha.executeTool("coingecko_searchCoin", {
  query: "avax",
  limit: 1,
});

console.log(result.output);
curl -X POST "https://api.kirha.com/tools/v1/execute" \
     -H "Authorization: Bearer <your_api_key>" \
     -H "Content-Type: application/json" \
     -d '{
         "tool_name": "coingecko_searchCoin",
         "input": {
           "query": "avax",
           "limit": 1
         }
      }'
result = kirha.execute_tool("coingecko_searchCoin", {"query": "avax", "limit": 1})

print(result.output)
{
  "tool_name": "coingecko_searchCoin",
  "output": {
    "context": "Search results for \"avax\".",
    "coins": [
      {
        "id": "avalanche-2",
        "name": "Avalanche",
        "symbol": "AVAX",
        "marketCapRank": 27,
        "thumbnailUrl": "https://coin-images.coingecko.com/coins/images/12559/thumb/Avalanche_Circle_RedWhite_Trans.png",
        "imageUrl": "https://coin-images.coingecko.com/coins/images/12559/large/Avalanche_Circle_RedWhite_Trans.png"
      }
    ]
  },
  "is_error": false,
  "usage": { "estimated": 0, "consumed": 0 }
}

usage reports 0 here because coingecko_searchCoin is a free tool.

Track credit usage on the Dashboard.

Rate limits

Each Tools API route is limited to 120 requests per minute per organization. Over the limit, the API answers 429 with a Retry-After header.

API Reference

GET /tools/v1

const page = await kirha.listTools({ focus: "crypto", page: 1, limit: 20 });
curl -X GET "https://api.kirha.com/tools/v1?focus=crypto&page=1&limit=20" \
     -H "Authorization: Bearer <your_api_key>"
page = kirha.tools_page(focus="crypto", page=1, limit=20)

Prop

Type

GET /tools/v1/match

const match = await kirha.matchTools("what is the price of a coin", { limit: 5 });
curl -X GET "https://api.kirha.com/tools/v1/match?q=what+is+the+price+of+a+coin&limit=5" \
     -H "Authorization: Bearer <your_api_key>"
match = kirha.match("what is the price of a coin", limit=5)

Prop

Type

GET /tools/v1/:tool_name

const tool = await kirha.getTool("coingecko_searchCoin");
curl -X GET "https://api.kirha.com/tools/v1/coingecko_searchCoin" \
     -H "Authorization: Bearer <your_api_key>"
tool = kirha.get("coingecko_searchCoin")

Prop

Type

POST /tools/v1/execute

const result = await kirha.executeTool("coingecko_searchCoin", {
  query: "avax",
  limit: 1,
});
curl -X POST "https://api.kirha.com/tools/v1/execute" \
     -H "Authorization: Bearer <your_api_key>" \
     -H "Content-Type: application/json" \
     -d '{
         "tool_name": "coingecko_searchCoin",
         "input": { "query": "avax", "limit": 1 }
      }'
result = kirha.execute_tool("coingecko_searchCoin", {"query": "avax", "limit": 1})

Prop

Type

On this page