メインコンテンツにスキップ

MCPツールリファレンス

Casdoor MCPサーバーは、Casdoorオブジェクトを管理するツールを提供します。このページでは、ツールのリスト方法、呼び出し方法、および戻り値について説明します。

ツールのリスト表示​

tools/list を呼び出します:

POST /api/mcp
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list"
}

レスポンスに含まれるツールは、リクエストの認証方法によって異なります:

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

各ツールには、説明と入力スキーマが付属しています:

{
"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"]
}
}
]
}
}

アプリケーションツール​

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

ユーザーツール​

ユーザーツールはアプリケーションツールと同様に動作します。

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

その他のツール​

商用またはエンタープライズライセンスでは、サーバーには組織、プロバイダー、ロール、権限、グループ、証明書、トークンを管理するためのツール、アプリ向けにアプリケーションを設定しサードパーティログインを接続するためのツール、すべての変更のドライラン機能、エージェントによる変更の記録、および変更の承認とロールバック機能が追加されます。詳細については、「AI エージェントによる Casdoor の管理」を参照してください。各ツールに必要なスコープについては、「スコープリファレンス」を参照してください。

結果フォーマット​

呼び出しが成功すると、結果は 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
}
}

スコープの欠落などプロトコル自体のエラーは JSON-RPC エラーです。MCP エラー処理を参照してください。

関連項目​