MCPcopy Create free account
hub / github.com/arctic-cli/interface / execute

Function execute

packages/arctic/src/session/prompt.ts:888–938  ·  view source on GitHub ↗
(args, options)

Source from the content-addressed store, hash-verified

886 description: item.description,
887 inputSchema: jsonSchema(schema as any),
888 async execute(args, options) {
889 const rawToolName = item.id
890 Telemetry.toolInvoked(rawToolName)
891
892 await Plugin.trigger(
893 "tool.execute.before",
894 {
895 tool: rawToolName,
896 sessionID: input.sessionID,
897 callID: options.toolCallId,
898 },
899 {
900 args,
901 },
902 )
903 const result = await item.execute(args, {
904 sessionID: input.sessionID,
905 abort: options.abortSignal!,
906 messageID: input.processor.message.id,
907 callID: options.toolCallId,
908 extra: { model: input.model },
909 agent: input.agent.name,
910 metadata: async (val) => {
911 const match = input.processor.partFromToolCall(options.toolCallId)
912 if (match && match.state.status === "running") {
913 await Session.updatePart({
914 ...match,
915 state: {
916 title: val.title,
917 metadata: val.metadata,
918 status: "running",
919 input: args,
920 time: {
921 start: Date.now(),
922 },
923 },
924 })
925 }
926 },
927 })
928 await Plugin.trigger(
929 "tool.execute.after",
930 {
931 tool: rawToolName,
932 sessionID: input.sessionID,
933 callID: options.toolCallId,
934 },
935 result,
936 )
937 return result
938 },
939 toModelOutput(result) {
940 return {
941 type: "text",

Callers 1

resolveToolsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected