MCP-Tools-Referenz
Der Casdoor-MCP-Server bietet Tools zur Verwaltung von Casdoor-Objekten. Diese Seite beschreibt, wie man die Tools auflistet, wie man sie aufruft und was sie zurückgeben.
Tools auflisten
Rufen Sie tools/list auf:
POST /api/mcp
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list"
}
Welche Tools die Antwort enthält, hängt davon ab, wie die Anfrage authentifiziert wird:
| 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 |
Jedes Tool verfügt über eine Beschreibung und ein Eingabeschema:
{
"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"]
}
}
]
}
}
Anwendungs-Tools
| 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 |
Rufen Sie ein Tool mit tools/call, dem Namen des Tools und seinen Argumenten auf.
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"
}
}
}
}
Benutzertools
Die Benutzertools funktionieren wie die Application-Tools.
| 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 |
Andere Tools
Mit einer kommerziellen oder Enterprise-Lizenz verfügt der Server auch über Tools für Organisationen, Provider, Rollen, Berechtigungen, Gruppen, Zertifikate und Tokens, Tools zum Einrichten einer Anwendung für eine App und zum Verbinden von Drittanbieter-Anmeldungen, einen Dry Run jeder Änderung, ein Protokoll der von Agenten vorgenommenen Änderungen sowie die Genehmigung und Rückgängigmachung der Änderungen. Siehe Let AI agents manage Casdoor. Für den Scope, den jedes Tool erfordert, siehe die Scope-Referenz.
Ergebnisformat
Ein erfolgreicher Aufruf gibt das Ergebnis als Inhalt zurück:
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"content": [
{
"type": "text",
"text": "[{\"name\":\"app1\",\"displayName\":\"App 1\"}]"
}
]
}
}
Wenn ein Tool fehlschlägt, enthält das Ergebnis den isError-Flag:
{
"jsonrpc": "2.0",
"id": 5,
"result": {
"content": [
{
"type": "text",
"text": "application quota is exceeded"
}
],
"isError": true
}
}
Fehler des Protokolls selbst, wie z. B. ein fehlender Scope, sind JSON-RPC-Fehler. Siehe MCP-Fehlerbehandlung.