Skip to main content

graphrt_core/
tool_node.rs

1//! The generic `tool` node and [`NativeTools`], a [`ToolRuntime`] built from
2//! Rust closures.
3//!
4//! The `tool` node calls one tool of a provider registered in the
5//! [`ToolRegistry`] service:
6//!
7//! ```yaml
8//! - id: weather
9//!   type: tool
10//!   provider_id: builtin          # or e.g. "mcp:github"
11//!   tool_name: get_weather
12//!   tool_parameters:
13//!     city:  { type: variable, value: [start, city] }
14//!     units: { type: constant, value: metric }
15//!     note:  { type: mixed,    value: "asked by {{#sys.user_id#}}" }
16//! ```
17//!
18//! A simpler `arguments` map is also accepted: string values are templates
19//! (a lone `{{#a.b#}}` placeholder keeps its typed value), other values are
20//! constants.
21//!
22//! Outputs: `text` (string), `json` (structured result, or `null`; when the text
23//! looks like JSON but does not parse, metadata `json_error` says why), `files`
24//! (array, currently always empty), `is_error` (bool) and `error` (the tool's error
25//! text, or `null`). A tool-reported error fails the node unless
26//! `ignore_tool_errors` is set, in which case `is_error` / `error` let a downstream
27//! branch react. `variable` arguments that do not resolve are sent as `null` and
28//! listed in metadata `missing_arguments`.
29
30use std::fmt;
31use std::future::Future;
32use std::sync::Arc;
33
34use futures::future::BoxFuture;
35use indexmap::IndexMap;
36use serde::Deserialize;
37
38use crate::dsl::NodeDoc;
39use crate::node::{ConfigError, Node, NodeContext, NodeError, NodeOutput, NodeResult, Registry, parse_config};
40use crate::pool::{Selector, VariablePool};
41use crate::template::Template;
42use crate::tool::{ToolCallContext, ToolError, ToolOutput, ToolRegistry, ToolRuntime, ToolSpec};
43use crate::value::Value;
44
45/// Node kind handled by [`ToolNode`].
46pub const KIND: &str = "tool";
47
48/// Register the `tool` node kind.
49pub fn register(registry: &mut Registry) {
50    registry.register_lazily_described(KIND, descriptor, |doc| {
51        ToolNode::from_doc(doc).map(|n| Arc::new(n) as Arc<dyn Node>)
52    });
53}
54
55/// Catalog descriptor of the `tool` node.
56pub fn descriptor() -> crate::catalog::NodeDescriptor {
57    use crate::catalog::schema::{nested, object, selector};
58    use crate::catalog::{NodeCategory, NodeDescriptor, OutputDescriptor};
59    use crate::value::ValueType;
60
61    let parameter = serde_json::json!({
62        "oneOf": [
63            nested(serde_json::json!({ "type": { "const": "mixed" }, "value": { "type": "string" } }), &["type", "value"]),
64            nested(serde_json::json!({ "type": { "const": "variable" }, "value": selector() }), &["type", "value"]),
65            nested(serde_json::json!({ "type": { "const": "constant" }, "value": {} }), &["type"])
66        ]
67    });
68    NodeDescriptor::new(KIND, "Tool", NodeCategory::Integration)
69        .describe(
70            "Calls one tool from a registered tool provider (native tools, MCP servers, plugins). \
71             Arguments: `tool_parameters` (mixed template / variable / constant) override `arguments` \
72             (strings are templates) which override `tool_configurations` (constants).",
73        )
74        .icon("wrench")
75        .source("builtin")
76        .schema(object(
77            serde_json::json!({
78                "provider_id": { "type": "string", "minLength": 1 },
79                "provider": { "type": "string", "minLength": 1 },
80                "provider_name": { "type": "string", "minLength": 1 },
81                "tool_name": { "type": "string", "minLength": 1 },
82                "tool_parameters": { "type": "object", "additionalProperties": parameter },
83                "tool_configurations": { "type": "object" },
84                "arguments": { "type": "object" },
85                "ignore_tool_errors": { "type": "boolean", "default": false }
86            }),
87            &["tool_name"],
88        ))
89        .output(OutputDescriptor::new("text", ValueType::String).describe("Text result"))
90        .output(OutputDescriptor::new("json", ValueType::Any).describe("Structured result, or the text parsed as JSON"))
91        .output(OutputDescriptor::new("files", ValueType::ArrayFile))
92        .output(OutputDescriptor::new("is_error", ValueType::Boolean))
93        .output(OutputDescriptor::new("error", ValueType::String).describe("Error text when the tool reported one"))
94}
95
96/// How one tool argument is produced.
97#[derive(Clone, Debug, PartialEq, Deserialize)]
98#[serde(tag = "type", rename_all = "lowercase")]
99enum ArgSource {
100    /// Text template, rendered against the pool.
101    Mixed { value: Template },
102    /// Value read from a selector (typed).
103    Variable { value: Selector },
104    /// Literal value.
105    Constant {
106        #[serde(default)]
107        value: Value,
108    },
109}
110
111#[derive(Debug, Deserialize)]
112struct ToolNodeConfig {
113    #[serde(alias = "provider", alias = "provider_name")]
114    provider_id: String,
115    tool_name: String,
116    #[serde(default)]
117    tool_parameters: IndexMap<String, ArgSource>,
118    /// Constant configuration parameters; lowest precedence.
119    #[serde(default)]
120    tool_configurations: IndexMap<String, Value>,
121    /// Shorthand: strings are templates, everything else a constant.
122    #[serde(default)]
123    arguments: IndexMap<String, Value>,
124    /// When true, a tool-reported error becomes a normal output instead of a node failure.
125    #[serde(default)]
126    ignore_tool_errors: bool,
127}
128
129/// Calls one tool from the [`ToolRegistry`] service.
130#[derive(Debug, Clone)]
131pub struct ToolNode {
132    provider: String,
133    tool: String,
134    /// Arguments in precedence order (later entries override earlier ones).
135    args: Vec<(String, ArgSource)>,
136    ignore_tool_errors: bool,
137}
138
139impl ToolNode {
140    /// Build from a node document.
141    pub fn from_doc(doc: &NodeDoc) -> Result<Self, ConfigError> {
142        let cfg: ToolNodeConfig = parse_config(doc)?;
143        if cfg.provider_id.trim().is_empty() {
144            return Err(ConfigError::new(doc, "`provider_id` must not be empty"));
145        }
146        if cfg.tool_name.trim().is_empty() {
147            return Err(ConfigError::new(doc, "`tool_name` must not be empty"));
148        }
149        let mut args: Vec<(String, ArgSource)> = Vec::new();
150        for (k, v) in cfg.tool_configurations {
151            args.push((k, ArgSource::Constant { value: v }));
152        }
153        for (k, v) in cfg.arguments {
154            let source = match v {
155                Value::String(s) => ArgSource::Mixed { value: Template::parse(&s) },
156                other => ArgSource::Constant { value: other },
157            };
158            args.push((k, source));
159        }
160        for (k, v) in cfg.tool_parameters {
161            args.push((k, v));
162        }
163        Ok(Self { provider: cfg.provider_id, tool: cfg.tool_name, args, ignore_tool_errors: cfg.ignore_tool_errors })
164    }
165
166    /// Resolve arguments. Returns `(plaintext arguments for the call, masked copy for observability)`.
167    fn resolve_args(&self, pool: &VariablePool) -> (serde_json::Value, Value) {
168        let mut exposed = serde_json::Map::new();
169        let mut masked: IndexMap<String, Value> = IndexMap::new();
170        for (name, source) in &self.args {
171            match source {
172                // Text templates: render twice so the observable copy keeps secrets masked.
173                ArgSource::Mixed { value } if !matches!(value.parts(), [crate::template::Part::Var(_)]) => {
174                    exposed.insert(name.clone(), serde_json::Value::String(value.render_exposed(pool)));
175                    masked.insert(name.clone(), Value::from(value.render(pool)));
176                }
177                _ => {
178                    let value = match source {
179                        // A lone placeholder keeps the typed value (numbers stay numbers).
180                        ArgSource::Mixed { value } => value.resolve(pool),
181                        ArgSource::Variable { value } => pool.get_or_null(value),
182                        ArgSource::Constant { value } => value.clone(),
183                    };
184                    exposed.insert(name.clone(), value.to_json_exposed());
185                    masked.insert(name.clone(), value);
186                }
187            }
188        }
189        (serde_json::Value::Object(exposed), Value::from(masked))
190    }
191
192    async fn execute(&self, ctx: NodeContext) -> NodeResult {
193        let registry = ctx.require_service::<ToolRegistry>("tool registry")?;
194        let runtime = registry
195            .get(&self.provider)
196            .ok_or_else(|| NodeError::fatal("tool", format!("unknown tool provider `{}`", self.provider)))?
197            .clone();
198        let (arguments, masked_args) = self.resolve_args(&ctx.pool);
199        let missing = self.missing_variables(&ctx.pool);
200        // Arguments already carry rendered secrets here: the node config is written by the
201        // workflow author, not a model, so there is no separate context channel.
202        let output = runtime
203            .call(&self.tool, arguments, ToolCallContext::empty())
204            .await
205            .map_err(|e| NodeError::new("tool", e.to_string()))?;
206        if output.is_error && !self.ignore_tool_errors {
207            return Err(NodeError::fatal("tool_error", output.text));
208        }
209        let (json, json_error) =
210            if output.data.is_null() { parse_json_text(&output.text) } else { (output.data, None) };
211        // With `ignore_tool_errors`, the failure stays visible to the graph through the
212        // `is_error` / `error` outputs so a downstream branch can react to it.
213        let error = if output.is_error { Value::from(output.text.as_str()) } else { Value::Null };
214        let mut result = NodeOutput::new()
215            .with("text", output.text)
216            .with("json", json)
217            .with("files", Value::array([]))
218            .with("is_error", output.is_error)
219            .with("error", error)
220            .meta("provider", self.provider.as_str())
221            .meta("tool", self.tool.as_str())
222            .meta("arguments", masked_args);
223        if let Some(e) = json_error {
224            result = result.meta("json_error", e);
225        }
226        if !missing.is_empty() {
227            result = result.meta("missing_arguments", Value::array(missing.into_iter().map(Value::from)));
228        }
229        Ok(result.into())
230    }
231
232    /// Selectors of `variable` arguments that do not resolve (sent to the tool as `null`).
233    fn missing_variables(&self, pool: &VariablePool) -> Vec<String> {
234        self.args
235            .iter()
236            .filter_map(|(_, source)| match source {
237                ArgSource::Variable { value } if pool.get(value).is_none() => Some(value.to_string()),
238                _ => None,
239            })
240            .collect()
241    }
242}
243
244/// Structured view of a text result when it looks like a JSON object or array.
245/// Returns the parse error when it looks like JSON but is not valid.
246fn parse_json_text(text: &str) -> (Value, Option<String>) {
247    let trimmed = text.trim_start();
248    if trimmed.starts_with('{') || trimmed.starts_with('[') {
249        return match serde_json::from_str::<serde_json::Value>(text) {
250            Ok(json) => (Value::from_json(json), None),
251            Err(e) => (Value::Null, Some(e.to_string())),
252        };
253    }
254    (Value::Null, None)
255}
256
257impl Node for ToolNode {
258    fn run(&self, ctx: NodeContext) -> BoxFuture<'_, NodeResult> {
259        Box::pin(self.execute(ctx))
260    }
261
262    fn inputs(&self) -> Vec<Selector> {
263        let mut out = Vec::new();
264        for (_, source) in &self.args {
265            match source {
266                ArgSource::Mixed { value } => out.extend(value.selectors().cloned()),
267                ArgSource::Variable { value } => out.push(value.clone()),
268                ArgSource::Constant { .. } => {}
269            }
270        }
271        out
272    }
273}
274
275type ToolFn = Arc<dyn Fn(serde_json::Value) -> BoxFuture<'static, Result<ToolOutput, ToolError>> + Send + Sync>;
276
277/// A [`ToolRuntime`] whose tools are Rust closures.
278///
279/// ```
280/// use graphrt_core::tool::{ToolOutput, ToolSpec};
281/// use graphrt_core::tool_node::NativeTools;
282///
283/// let tools = NativeTools::new().with(
284///     ToolSpec {
285///         name: "echo".into(),
286///         description: "Echo the `text` argument".into(),
287///         parameters: serde_json::json!({
288///             "type": "object",
289///             "properties": { "text": { "type": "string" } },
290///             "required": ["text"]
291///         }),
292///     },
293///     |args| async move { Ok(ToolOutput::text(args["text"].as_str().unwrap_or_default())) },
294/// );
295/// ```
296#[derive(Clone, Default)]
297pub struct NativeTools {
298    tools: IndexMap<String, (ToolSpec, ToolFn)>,
299}
300
301impl fmt::Debug for NativeTools {
302    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
303        f.debug_struct("NativeTools").field("tools", &self.tools.keys().collect::<Vec<_>>()).finish()
304    }
305}
306
307impl NativeTools {
308    pub fn new() -> Self {
309        Self::default()
310    }
311
312    /// Add (or replace) a tool.
313    pub fn add<F, Fut>(&mut self, spec: ToolSpec, handler: F) -> &mut Self
314    where
315        F: Fn(serde_json::Value) -> Fut + Send + Sync + 'static,
316        Fut: Future<Output = Result<ToolOutput, ToolError>> + Send + 'static,
317    {
318        let handler: ToolFn = Arc::new(move |args| Box::pin(handler(args)));
319        self.tools.insert(spec.name.clone(), (spec, handler));
320        self
321    }
322
323    /// Builder-style [`NativeTools::add`].
324    pub fn with<F, Fut>(mut self, spec: ToolSpec, handler: F) -> Self
325    where
326        F: Fn(serde_json::Value) -> Fut + Send + Sync + 'static,
327        Fut: Future<Output = Result<ToolOutput, ToolError>> + Send + 'static,
328    {
329        self.add(spec, handler);
330        self
331    }
332
333    pub fn len(&self) -> usize {
334        self.tools.len()
335    }
336
337    pub fn is_empty(&self) -> bool {
338        self.tools.is_empty()
339    }
340}
341
342impl ToolRuntime for NativeTools {
343    fn list(&self) -> BoxFuture<'_, Result<Vec<ToolSpec>, ToolError>> {
344        let specs = self.tools.values().map(|(spec, _)| spec.clone()).collect();
345        Box::pin(futures::future::ready(Ok(specs)))
346    }
347
348    /// Native handlers take only arguments; the context is not forwarded
349    /// (`accepts_secrets` stays `false`).
350    fn call<'a>(
351        &'a self,
352        name: &'a str,
353        arguments: serde_json::Value,
354        _context: &'a ToolCallContext,
355    ) -> BoxFuture<'a, Result<ToolOutput, ToolError>> {
356        let Some((spec, handler)) = self.tools.get(name) else {
357            return Box::pin(futures::future::ready(Err(ToolError {
358                tool: name.to_owned(),
359                message: "unknown tool".to_owned(),
360            })));
361        };
362        if let Err(message) = check_required(&spec.parameters, &arguments) {
363            return Box::pin(futures::future::ready(Err(ToolError { tool: name.to_owned(), message })));
364        }
365        handler(arguments)
366    }
367}
368
369/// Lightweight argument check: the arguments must be an object containing every
370/// property listed in the schema's `required` array. Full JSON Schema validation
371/// is left to the tool itself.
372fn check_required(schema: &serde_json::Value, arguments: &serde_json::Value) -> Result<(), String> {
373    let Some(args) = arguments.as_object() else {
374        return Err("arguments must be a JSON object".to_owned());
375    };
376    let required = schema.get("required").and_then(serde_json::Value::as_array);
377    let missing: Vec<&str> = required
378        .into_iter()
379        .flatten()
380        .filter_map(serde_json::Value::as_str)
381        .filter(|key| args.get(*key).is_none_or(serde_json::Value::is_null))
382        .collect();
383    if missing.is_empty() { Ok(()) } else { Err(format!("missing required arguments: {}", missing.join(", "))) }
384}
385
386#[cfg(test)]
387mod tests {
388    use std::sync::Mutex;
389
390    use super::*;
391    use crate::node::{NodeOutcome, Services};
392
393    #[derive(Debug, Default)]
394    struct Recorder {
395        calls: Mutex<Vec<(String, serde_json::Value)>>,
396        reply: Option<ToolOutput>,
397    }
398
399    impl ToolRuntime for Recorder {
400        fn list(&self) -> BoxFuture<'_, Result<Vec<ToolSpec>, ToolError>> {
401            Box::pin(futures::future::ready(Ok(Vec::new())))
402        }
403        fn call<'a>(
404            &'a self,
405            name: &'a str,
406            arguments: serde_json::Value,
407            _context: &'a ToolCallContext,
408        ) -> BoxFuture<'a, Result<ToolOutput, ToolError>> {
409            self.calls.lock().unwrap().push((name.to_owned(), arguments));
410            let reply = self.reply.clone().unwrap_or_else(|| ToolOutput::text("{\"ok\":true}"));
411            Box::pin(futures::future::ready(Ok(reply)))
412        }
413    }
414
415    fn doc(config: serde_json::Value) -> NodeDoc {
416        NodeDoc::new("t", KIND, config)
417    }
418
419    fn pool() -> VariablePool {
420        let mut p = VariablePool::new();
421        p.insert("start", "city", Value::from("Jakarta"));
422        p.insert("start", "days", Value::Int(3));
423        p.insert("env", "TOKEN", Value::Secret(Arc::from("s3cret")));
424        p
425    }
426
427    fn ctx_with(runtime: Arc<dyn ToolRuntime>) -> NodeContext {
428        let mut reg = ToolRegistry::new();
429        reg.add("mock", runtime);
430        NodeContext::for_test("t", pool()).with_services(Arc::new(Services::new().with(reg)))
431    }
432
433    fn completed(r: NodeResult) -> NodeOutput {
434        match r {
435            Ok(NodeOutcome::Completed(o)) => o,
436            other => panic!("unexpected {other:?}"),
437        }
438    }
439
440    #[tokio::test]
441    async fn resolves_all_argument_kinds() {
442        let rec = Arc::new(Recorder::default());
443        let node = ToolNode::from_doc(&doc(serde_json::json!({
444            "provider_id": "mock",
445            "tool_name": "weather",
446            "tool_configurations": {"units": "imperial", "lang": "en"},
447            "arguments": {"note": "for {{#start.city#}}", "raw": 5},
448            "tool_parameters": {
449                "city": {"type": "variable", "value": ["start", "city"]},
450                "days": {"type": "mixed", "value": "{{#start.days#}}"},
451                "units": {"type": "constant", "value": "metric"},
452                "auth": {"type": "mixed", "value": "Bearer {{#env.TOKEN#}}"}
453            }
454        })))
455        .unwrap();
456        let out = completed(node.run(ctx_with(rec.clone())).await);
457        let calls = rec.calls.lock().unwrap();
458        let (name, args) = &calls[0];
459        assert_eq!(name, "weather");
460        assert_eq!(args["city"], "Jakarta");
461        assert_eq!(args["days"], 3);
462        assert_eq!(args["units"], "metric", "tool_parameters override configurations");
463        assert_eq!(args["lang"], "en");
464        assert_eq!(args["note"], "for Jakarta");
465        assert_eq!(args["raw"], 5);
466        assert_eq!(args["auth"], "Bearer s3cret", "tool receives the plaintext secret");
467        // Observability metadata never contains the secret.
468        let meta = serde_json::to_string(&out.metadata).unwrap();
469        assert!(!meta.contains("s3cret"));
470        assert_eq!(out.outputs["text"], Value::from("{\"ok\":true}"));
471        assert_eq!(out.outputs["json"].get_path(&["ok"]), Some(Value::Bool(true)));
472        assert_eq!(out.outputs["files"], Value::array([]));
473        assert_eq!(node.inputs().len(), 4); // note, city, days, auth
474    }
475
476    #[tokio::test]
477    async fn tool_error_fails_unless_ignored() {
478        let rec = Arc::new(Recorder { reply: Some(ToolOutput::error("boom")), ..Recorder::default() });
479        let cfg = serde_json::json!({"provider": "mock", "tool_name": "x"});
480        let node = ToolNode::from_doc(&doc(cfg)).unwrap();
481        let err = node.run(ctx_with(rec.clone())).await.unwrap_err();
482        assert_eq!(err.kind, "tool_error");
483        assert!(!err.retryable);
484
485        let cfg = serde_json::json!({"provider": "mock", "tool_name": "x", "ignore_tool_errors": true});
486        let node = ToolNode::from_doc(&doc(cfg)).unwrap();
487        let out = completed(node.run(ctx_with(rec)).await);
488        assert_eq!(out.outputs["text"], Value::from("boom"));
489        assert_eq!(out.outputs["is_error"], Value::Bool(true));
490        assert_eq!(out.outputs["error"], Value::from("boom"));
491    }
492
493    #[tokio::test]
494    async fn successful_call_has_no_error_output() {
495        let rec = Arc::new(Recorder { reply: Some(ToolOutput::text("{\"a\": 1")), ..Recorder::default() });
496        let node = ToolNode::from_doc(&doc(serde_json::json!({
497            "provider": "mock", "tool_name": "x",
498            "tool_parameters": {"city": {"type": "variable", "value": ["start", "nope"]}}
499        })))
500        .unwrap();
501        let out = completed(node.run(ctx_with(rec)).await);
502        assert_eq!(out.outputs["is_error"], Value::Bool(false));
503        assert_eq!(out.outputs["error"], Value::Null);
504        // Looks like JSON but is truncated: `json` is null and the reason is recorded.
505        assert_eq!(out.outputs["json"], Value::Null);
506        assert!(out.metadata.contains_key("json_error"));
507        assert_eq!(out.metadata["missing_arguments"], Value::array([Value::from("start.nope")]));
508    }
509
510    #[tokio::test]
511    async fn missing_provider_or_registry_is_fatal() {
512        let node = ToolNode::from_doc(&doc(serde_json::json!({"provider_id": "nope", "tool_name": "x"}))).unwrap();
513        let err = node.run(ctx_with(Arc::new(Recorder::default()))).await.unwrap_err();
514        assert!(!err.retryable);
515        let err = node.run(NodeContext::for_test("t", pool())).await.unwrap_err();
516        assert_eq!(err.kind, "missing_service");
517    }
518
519    #[test]
520    fn rejects_invalid_config() {
521        assert!(ToolNode::from_doc(&doc(serde_json::json!({"tool_name": "x"}))).is_err());
522        assert!(ToolNode::from_doc(&doc(serde_json::json!({"provider_id": " ", "tool_name": "x"}))).is_err());
523        let bad_param = serde_json::json!({"provider_id": "p", "tool_name": "x",
524            "tool_parameters": {"a": {"type": "variable", "value": ["only"]}}});
525        assert!(ToolNode::from_doc(&doc(bad_param)).is_err());
526    }
527
528    #[test]
529    fn registers_kind() {
530        let mut r = Registry::new();
531        register(&mut r);
532        assert!(r.contains(KIND));
533    }
534
535    fn echo_spec() -> ToolSpec {
536        ToolSpec {
537            name: "echo".into(),
538            description: "echo".into(),
539            parameters: serde_json::json!({"type": "object", "required": ["text"]}),
540        }
541    }
542
543    #[tokio::test]
544    async fn native_tools_dispatch_and_validate() {
545        let tools = NativeTools::new().with(echo_spec(), |args| async move {
546            Ok(ToolOutput::text(args["text"].as_str().unwrap_or_default().to_uppercase()))
547        });
548        assert_eq!(tools.len(), 1);
549        assert_eq!(tools.list().await.unwrap()[0].name, "echo");
550        let out = tools.call("echo", serde_json::json!({"text": "hi"}), ToolCallContext::empty()).await.unwrap();
551        assert_eq!(out.text, "HI");
552        let err = tools.call("echo", serde_json::json!({}), ToolCallContext::empty()).await.unwrap_err();
553        assert!(err.message.contains("text"));
554        assert!(tools.call("echo", serde_json::json!("str"), ToolCallContext::empty()).await.is_err());
555        assert!(tools.call("nope", serde_json::json!({}), ToolCallContext::empty()).await.is_err());
556    }
557
558    #[tokio::test]
559    async fn tool_node_with_native_tools() {
560        let tools = NativeTools::new().with(echo_spec(), |args| async move {
561            Ok(ToolOutput {
562                text: "done".into(),
563                data: Value::from_json(args),
564                is_error: false,
565                ..ToolOutput::default()
566            })
567        });
568        let node = ToolNode::from_doc(&doc(serde_json::json!({
569            "provider_id": "mock", "tool_name": "echo", "arguments": {"text": "{{#start.city#}}"}
570        })))
571        .unwrap();
572        let out = completed(node.run(ctx_with(Arc::new(tools))).await);
573        assert_eq!(out.outputs["json"].get_path(&["text"]), Some(Value::from("Jakarta")));
574    }
575}