MCPcopy Create free account
hub / github.com/astercloud/aster / HandleRequest

Method HandleRequest

pkg/a2a/server.go:40–54  ·  view source on GitHub ↗

HandleRequest 处理 JSON-RPC 请求

(ctx context.Context, agentID string, req *JSONRPCRequest)

Source from the content-addressed store, hash-verified

38
39// HandleRequest 处理 JSON-RPC 请求
40func (s *Server) HandleRequest(ctx context.Context, agentID string, req *JSONRPCRequest) *JSONRPCResponse {
41 switch req.Method {
42 case "message/send":
43 return s.handleMessageSend(ctx, agentID, req)
44 case "message/stream":
45 return s.handleMessageStream(ctx, agentID, req)
46 case "tasks/get":
47 return s.handleTasksGet(ctx, agentID, req)
48 case "tasks/cancel":
49 return s.handleTasksCancel(ctx, agentID, req)
50 default:
51 return NewErrorResponse(req.ID, ErrorCodeMethodNotFound,
52 "method not found: "+req.Method, nil)
53 }
54}
55
56// GetAgentCard 获取 Agent Card
57func (s *Server) GetAgentCard(agentID string) (*AgentCard, error) {

Calls 5

handleMessageSendMethod · 0.95
handleMessageStreamMethod · 0.95
handleTasksGetMethod · 0.95
handleTasksCancelMethod · 0.95
NewErrorResponseFunction · 0.85