Call Tool
curl --request POST \
--url https://api.klavis.ai/mcp-server/call-tool \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"serverUrl": "<string>",
"toolName": "<string>",
"toolArgs": {},
"connectionType": "StreamableHttp",
"headers": {}
}
'import requests
url = "https://api.klavis.ai/mcp-server/call-tool"
payload = {
"serverUrl": "<string>",
"toolName": "<string>",
"toolArgs": {},
"connectionType": "StreamableHttp",
"headers": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
serverUrl: '<string>',
toolName: '<string>',
toolArgs: {},
connectionType: 'StreamableHttp',
headers: {}
})
};
fetch('https://api.klavis.ai/mcp-server/call-tool', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
serverUrl: '<string>',
toolName: '<string>',
toolArgs: {},
connectionType: 'StreamableHttp',
headers: {}
})
};
fetch('https://api.klavis.ai/mcp-server/call-tool', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"success": true,
"result": {
"content": [
"<unknown>"
],
"isError": false
},
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Function Calling with MCP
Call Tool
Calls a tool on a specific remote MCP server, used for function calling. Eliminates the need for manual MCP code implementation. Under the hood, Klavis will instantiates an MCP client and establishes a connection with the remote MCP server to call the tool.
POST
/
mcp-server
/
call-tool
Call Tool
curl --request POST \
--url https://api.klavis.ai/mcp-server/call-tool \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"serverUrl": "<string>",
"toolName": "<string>",
"toolArgs": {},
"connectionType": "StreamableHttp",
"headers": {}
}
'import requests
url = "https://api.klavis.ai/mcp-server/call-tool"
payload = {
"serverUrl": "<string>",
"toolName": "<string>",
"toolArgs": {},
"connectionType": "StreamableHttp",
"headers": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
serverUrl: '<string>',
toolName: '<string>',
toolArgs: {},
connectionType: 'StreamableHttp',
headers: {}
})
};
fetch('https://api.klavis.ai/mcp-server/call-tool', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
serverUrl: '<string>',
toolName: '<string>',
toolArgs: {},
connectionType: 'StreamableHttp',
headers: {}
})
};
fetch('https://api.klavis.ai/mcp-server/call-tool', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"success": true,
"result": {
"content": [
"<unknown>"
],
"isError": false
},
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Your Klavis AI API key.
Body
application/json
The full URL for connecting to the MCP server
The name of the tool to call
The input parameters for the tool
The connection type to use for the MCP server. Default is STREAMABLE_HTTP.
Available options:
SSE, StreamableHttp Optional HTTP headers to include when connecting to the server
Show child attributes
Show child attributes
