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

# validateToolResponse

> Checks a tool's answer against the card shape its declared returns kind has to carry, and returns what is missing.

```ts theme={null}
function validateToolResponse(value, returns): string[];
```

Checks a tool's answer against the card shape its declared `returns` kind has to
carry, and returns what is missing.

## Parameters

### value

`unknown`

### returns

`"list"` | `"table"` | `"comparison"` | `"series"` | `"value"`

## Returns

`string`\[]

## Remarks

Returns an empty array when the answer is sound. A `value` card needs `label` and
`value`, a `series` card `label` and `points`, a `table` card `columns` and
`rows`, a `list` card `items`, and a `comparison` card `label`, `left` and
`right`; anything that is not an object is reported on its own. It checks the
keys are present, not what they hold, so an empty `rows` array passes.

## Example

```ts theme={null}
import { validateToolResponse } from '@tappify/extension-sdk/testing';
import { expect, it } from 'vitest';

it('answers keyword_gaps with a table card', () => {
  const card = { columns: [{ key: 'term', label: 'Term' }], rows: [] };
  expect(validateToolResponse(card, 'table')).toEqual([]);
});
```
