# Correct argument usage

{% embed url="<https://youtu.be/_67r4wq23BA?t=254>" %}

You can specify the exact arguments and the minimum/maximum number of arguments for each command. If the user provides an incorrect number of arguments then WOKCommands will automatically tell them the correct usage based off of the command properties you provided. Here is an example:

{% tabs %}
{% tab title="JavaScript" %}
{% code title="add.js" %}

```javascript
import { CommandType } from "wokcommands";

module.exports = {
  description: "Adds numbers together",
  type: CommandType.BOTH,

  minArgs: 2,
  maxArgs: 2,
  expectedArgs: "<num1> <num2>",

  callback: ({ args }) => {
    const sum = args.reduce((acc, cur) => {
      return acc + Number(cur)
    }, 0)

    return `The sum is ${sum}`
  },
}
```

{% endcode %}
{% endtab %}

{% tab title="TypeScript" %}
{% code title="add.ts" %}

```typescript
import { CommandType, CommandObject, CommandUsage } from "wokcommands";

export default {
  description: "Adds numbers together",
  type: CommandType.BOTH,

  minArgs: 2,
  maxArgs: 2,
  expectedArgs: "<num1> <num2>",;

  callback: (options: CommandUsage) => {
    const { args } = options

    const sum = args.reduce((acc, cur) => {
      return acc + Number(cur)
    }, 0)

    return `The sum is ${sum}`
  },
} as CommandObject;
```

{% endcode %}
{% endtab %}
{% endtabs %}

If the user runs `!add` or `!add 5` your bot will respond with `Correct syntax: !add <num1> <num2>`. If the user runs `!add 5 10` it will then respond with `The sum is 15`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wornoffkeys.com/commands/correct-argument-usage.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
