Довідник інструментів MCP
MCP-сервер Casdoor пропонує інструменти для керування об'єктами Casdoor. На цій сторінці описано, як переглянути список інструментів, як їх викликати та що вони повертають.
Перегляд інструментів
Викличте tools/list:
POST /api/mcp
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list"
}
Той набір інструментів, який містить відповідь, залежить від способу автентифікації запиту:
| Authentication | Tools in the response |
|---|---|
| None | All tools, so that clients can discover them. Calling a tool still requires authentication |
| Session cookie | All tools |
| Access token | The tools that the scopes of the token allow |
Кожен інструмент має опис і схему вхідних даних:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"tools": [
{
"name": "get_applications",
"description": "Get all applications for a specific owner",
"inputSchema": {
"type": "object",
"properties": {
"owner": {
"type": "string",
"description": "The owner of applications"
}
},
"required": ["owner"]
}
}
]
}
}
Інструменти додатків
| Tool | Description |
|---|---|
get_applications | Gets all applications of an organization |
get_application | Gets one application |
add_application | Creates an application |
update_application | Changes an application |
delete_application | Deletes an application |
Викличте інструмент за допомогою tools/call, назви інструмента та його аргументів.
get_applications:
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "get_applications",
"arguments": {
"owner": "my-org"
}
}
}
get_application:
{
"jsonrpc": "2.0",
"id": 4,
"method": "tools/call",
"params": {
"name": "get_application",
"arguments": {
"id": "my-org/my-app"
}
}
}
add_application:
{
"jsonrpc": "2.0",
"id": 5,
"method": "tools/call",
"params": {
"name": "add_application",
"arguments": {
"application": {
"owner": "my-org",
"name": "new-app",
"displayName": "New Application",
"organization": "my-org"
}
}
}
}
update_application:
{
"jsonrpc": "2.0",
"id": 6,
"method": "tools/call",
"params": {
"name": "update_application",
"arguments": {
"id": "my-org/my-app",
"application": {
"owner": "my-org",
"name": "my-app",
"displayName": "Updated Name"
}
}
}
}
delete_application:
{
"jsonrpc": "2.0",
"id": 7,
"method": "tools/call",
"params": {
"name": "delete_application",
"arguments": {
"application": {
"owner": "my-org",
"name": "old-app"
}
}
}
}
Інструменти користувача
Інструменти користувача працюють так само, як інструменти додатків.
| Tool | Arguments | Description |
|---|---|---|
get_users | owner | Lists all users of an organization |
get_user | id, or owner and email, or owner and phone | Gets one user |
add_user | user object | Creates a user |
update_user | id and user object | Changes a user |
delete_user | user object | Deletes a user |
Інші інструменти
З комерційною або корпоративною ліцензією сервер також має інструменти для organization, provider, role, permission, group, cert та token, інструменти для налаштування додатка для app та підключення стороннього входу, пробний запуск (dry run) кожної зміни, запис про те, що змінили агенти, а також затвердження та відкат змін. Див. Let AI agents manage Casdoor. Для області видимості (scope), яку потребує кожен інструмент, див. scope reference.
Формат результату
Успішний виклик повертає результат як вміст (content):
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"content": [
{
"type": "text",
"text": "[{\"name\":\"app1\",\"displayName\":\"App 1\"}]"
}
]
}
}
Якщо інструмент завершується помилкою, у результаті встановлюється прапорець isError:
{
"jsonrpc": "2.0",
"id": 5,
"result": {
"content": [
{
"type": "text",
"text": "application quota is exceeded"
}
],
"isError": true
}
}
Помилки самого протоколу, наприклад відсутня область (scope), є помилками JSON-RPC. Дивіться обробка помилок MCP.