MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / Execute

Method Execute

internal/pluginhost/adapters.go:1592–1617  ·  view source on GitHub ↗
(ctx context.Context, auth *coreauth.Auth, req coreexecutor.Request, opts coreexecutor.Options)

Source from the content-addressed store, hash-verified

1590}
1591
1592func (a *executorAdapter) Execute(ctx context.Context, auth *coreauth.Auth, req coreexecutor.Request, opts coreexecutor.Options) (resp coreexecutor.Response, err error) {
1593 if a == nil || a.executor == nil || a.host.isPluginFused(a.pluginID) || !a.host.pluginIdentityCurrent(a.pluginID, a.path, a.version) {
1594 return coreexecutor.Response{}, fmt.Errorf("plugin executor %s is unavailable", a.Identifier())
1595 }
1596 defer func() {
1597 if recovered := recover(); recovered != nil {
1598 a.host.fusePlugin(a.pluginID, "Executor.Execute", recovered)
1599 resp = coreexecutor.Response{}
1600 err = fmt.Errorf("plugin executor %s panic: %v", a.Identifier(), recovered)
1601 }
1602 }()
1603
1604 prepared, errPrepare := a.prepareExecutorCall(req, opts)
1605 if errPrepare != nil {
1606 return coreexecutor.Response{}, errPrepare
1607 }
1608 pluginResp, errExecute := a.executor.Execute(ctx, buildExecutorRequest(a.host, a.provider, auth, prepared.req, prepared.opts))
1609 if errExecute != nil {
1610 return coreexecutor.Response{}, errExecute
1611 }
1612 return coreexecutor.Response{
1613 Payload: a.translateExecutorResponse(ctx, prepared, pluginResp.Payload, false, nil),
1614 Metadata: cloneAnyMap(pluginResp.Metadata),
1615 Headers: cloneHeader(pluginResp.Headers),
1616 }, nil
1617}
1618
1619func (a *executorAdapter) ExecuteStream(ctx context.Context, auth *coreauth.Auth, req coreexecutor.Request, opts coreexecutor.Options) (result *coreexecutor.StreamResult, err error) {
1620 if a == nil || a.executor == nil || a.host.isPluginFused(a.pluginID) || !a.host.pluginIdentityCurrent(a.pluginID, a.path, a.version) {

Callers

nothing calls this directly

Calls 10

IdentifierMethod · 0.95
prepareExecutorCallMethod · 0.95
buildExecutorRequestFunction · 0.85
cloneAnyMapFunction · 0.85
isPluginFusedMethod · 0.80
pluginIdentityCurrentMethod · 0.80
fusePluginMethod · 0.80
cloneHeaderFunction · 0.70
ExecuteMethod · 0.65

Tested by

no test coverage detected