You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bf04fb3
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: app/en/home/build-tools/create-a-tool-with-secrets/page.mdx
+78-8Lines changed: 78 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,32 +26,102 @@ Build an MCP tool that can read a secret from Context and return a masked confir
26
26
<GuideOverview.YouWillLearn>
27
27
28
28
- How to read secrets from environment and `.env` files securely using a tool's Context.
29
+
- How to configure secrets in the Arcade Dashboard.
29
30
30
31
</GuideOverview.YouWillLearn>
31
32
</GuideOverview>
32
33
33
-
Secrets are sensitive strings like passwords, api-keys, or other tokens that grant access to a protected resource or API. Although you could use secrets to transfer any static information to your tool, such as a parameter needed to call a remote API. In this guide, you'll learn how to use secrets in your custom Arcade tools.
34
+
Secrets are sensitive strings like passwords, api-keys, or other tokens that grant access to a protected resource or API. Although you could use secrets to transfer any static information to your tool, such as a parameter needed to call a remote API.
35
+
36
+
## Why use secrets in your tools?
37
+
38
+
Secrets enable you to securely deploy a function that requires sensitive information at runtime. And while these can be consumed directly from the runtime environment inside your tool function, this becomes very inconvenient, expensive, hard to maintain, and insecure when deploying at scale.
39
+
40
+
For example, if your tool requires an API key to use an external service, but only _after_ doing some computationally expensive work, you need to ensure that the API key is present _before_ the computationally expensive work is done. The function below would fail if the API key is not present.
41
+
42
+
```python
43
+
import os
44
+
45
+
defmy_tool(task: str) -> str:
46
+
result = expensive_computation(task)
47
+
48
+
API_KEY= os.getenv("API_KEY")
49
+
50
+
# The line below will fail if the API key is not present
We can work around this by carefully checking for the API key before doing the computationally expensive work, of course, but this is error prone and difficult to maintain, and you may only become aware of the issue after deploying multiple instances of your server.
60
+
61
+
Arcade provides a way to securely store and access secrets inside your tools in a way that is easy to manage across multiple instances of your servers, and that will prevent the tool from running if the secret is not provided. In this guide, you'll learn how to use secrets in your custom Arcade tools.
34
62
35
63
<Steps>
36
64
37
65
## Store your secret
38
66
39
-
Secrets can be provided via environment variables.
67
+
Depending on where you're running your server, you can store your secret in a few different ways.
40
68
41
-
You can set the environment variable in your terminal like so:
0 commit comments