rpk ai mcp tools call
Invoke a tool on an MCP server through the aigw MCP proxy.
The server’s /mcp/v1/<name> endpoint is reached with the same bearer token used by the rest of rpai; aigw resolves user-delegated OAuth tokens from the vault when the MCP server is configured with --user-oauth-provider.
Arguments passed to the tool are a JSON object supplied via --args. Example:
rpk ai mcp tools call gf-servicenow-sand2 listtablerecords \
--args '{"tableName":"incident","sysparm_limit":3}'
With --code-mode the call targets the virtual code-mode sibling endpoint (/mcp/v1/<name>-code). That endpoint exposes search (tool catalog for the primary) and execute (runs JavaScript in a sandbox with call_tool bound to the primary’s tools). Example:
rpk ai mcp tools call pg-garrett execute --code-mode \
--args '{"code":"var r = call_tool({name:\"query\", arguments:{query:\"SELECT 1\"}}); JSON.stringify(r);"}'
Flags
| Value | Type | Description |
|---|---|---|
|
string |
JSON object of tool arguments, e.g. '{"foo":"bar"}'. Empty means no arguments. |
|
- |
Target the virtual code-mode sibling endpoint (<server>-code) instead of the primary. |
|
- |
help for call. |
|
string |
output format: table|wide|json|yaml|markdown (env: RPAI_FORMAT) (default "table"). |
|
- |
disable colored output (env: NO_COLOR). |
|
string |
path to rpai config (env: RPAI_CONFIG) (default "/var/lib/redpanda/.rpai/config"). |
|
string |
override the selected environment’s AI Gateway URL for this invocation. |
|
string |
rpai profile name (env: RPAI_PROFILE). |
|
- |
verbose debug logging to stderr (env: RPAI_VERBOSE). |
|
string |
static bearer token override (ambient RPAI_TOKEN is ignored under rpk ai). |