Zum Hauptinhalt springen

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:

AuthenticationTools in the response
NoneAll tools, so that clients can discover them. Calling a tool still requires authentication
Session cookieAll tools
Access tokenThe 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​

ToolDescription
get_applicationsGets all applications of an organization
get_applicationGets one application
add_applicationCreates an application
update_applicationChanges an application
delete_applicationDeletes 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.

ToolArgumentsDescription
get_usersownerLists all users of an organization
get_userid, or owner and email, or owner and phoneGets one user
add_useruser objectCreates a user
update_userid and user objectChanges a user
delete_useruser objectDeletes 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.

Siehe auch​