接入知识库查询MCP
This commit is contained in:
parent
4bbc743ef2
commit
271f42dd71
@ -22,4 +22,28 @@ public class KnowledgeBase
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
[McpServerTool, Description("查询ArcGIS Pro调用工具的标准调用名和参数要求知识库")]
|
||||
public static async Task<JsonRpcResultEntity> QueryArcgisToolDoc(string query)
|
||||
{
|
||||
DocDb docDb = new DocDb("sk-db177155677e438f832860e7f4da6afc", DocDb.KnowledgeBase.ArcGISProToolDoc);
|
||||
KnowledgeResult knowledgeResult = await docDb.Retrieve(query);
|
||||
JsonRpcResultEntity result = new JsonRpcSuccessEntity()
|
||||
{
|
||||
Result = JsonConvert.SerializeObject(knowledgeResult.ChunkList),
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
[McpServerTool, Description("查询使用ArcGIS Pro进行任务规划和解决实际问题的案例知识库")]
|
||||
public static async Task<JsonRpcResultEntity> QueryArcgisExampleDoc(string query)
|
||||
{
|
||||
DocDb docDb = new DocDb("sk-db177155677e438f832860e7f4da6afc", DocDb.KnowledgeBase.ArcGISProApplicantExample);
|
||||
KnowledgeResult knowledgeResult = await docDb.Retrieve(query);
|
||||
JsonRpcResultEntity result = new JsonRpcSuccessEntity()
|
||||
{
|
||||
Result = JsonConvert.SerializeObject(knowledgeResult.ChunkList),
|
||||
};
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -28,6 +28,13 @@ public class McpServerList
|
||||
Description = "可以调用arcgis的地理处理工具或执行python代码等",
|
||||
IsActive = true
|
||||
});
|
||||
servers.Add("KnowledgeBase", new InnerMcpServer
|
||||
{
|
||||
Name = "KnowledgeBase",
|
||||
Type = "inner",
|
||||
Description = "可以调用进行查询知识库,获取相关参考信息。",
|
||||
IsActive = true
|
||||
});
|
||||
}
|
||||
|
||||
public McpServer GetServer(string name)
|
||||
|
||||
@ -21,13 +21,14 @@ public class DocDb
|
||||
{
|
||||
ArcGISProHelpDoc,
|
||||
ArcGISProToolDoc,
|
||||
TaskPlanningDoc,
|
||||
ArcGISProApplicantExample
|
||||
}
|
||||
|
||||
public Dictionary<KnowledgeBase, string> knowledgeBase = new Dictionary<KnowledgeBase, string>
|
||||
{
|
||||
{KnowledgeBase.ArcGISProHelpDoc,"6a77c5a68de64f469b79fcdcde9d5001"}
|
||||
{KnowledgeBase.ArcGISProHelpDoc,"6a77c5a68de64f469b79fcdcde9d5001"},
|
||||
{KnowledgeBase.ArcGISProToolDoc,"080f8925318247ea822a9e12db5cb5cd"},
|
||||
{KnowledgeBase.ArcGISProApplicantExample,"eef60f7c879b4e8597138c261578d2a5"}
|
||||
};
|
||||
|
||||
public async Task<KnowledgeResult> Retrieve(string query)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user