Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ jobs:
with:
dotnet-version: '8.0.x'
- name: Restore
run: dotnet restore csharp-utcp/Utcp.sln
run: dotnet restore Utcp.sln
- name: Build
run: dotnet build csharp-utcp/Utcp.sln -c Release --no-restore
run: dotnet build Utcp.sln -c Release --no-restore
- name: Test
run: dotnet test csharp-utcp/Utcp.sln -c Release --no-build --verbosity normal
run: dotnet test Utcp.sln -c Release --no-build --verbosity normal
- name: Pack Core
run: dotnet pack csharp-utcp/src/Utcp.Core/Utcp.Core.csproj -c Release --no-build -o artifacts
run: dotnet pack src/Utcp.Core/Utcp.Core.csproj -c Release --no-build -o artifacts
- name: Pack Http
run: dotnet pack csharp-utcp/src/Utcp.Http/Utcp.Http.csproj -c Release --no-build -o artifacts
run: dotnet pack src/Utcp.Http/Utcp.Http.csproj -c Release --no-build -o artifacts
- name: Pack Cli
run: dotnet pack csharp-utcp/src/Utcp.Cli/Utcp.Cli.csproj -c Release --no-build -o artifacts
run: dotnet pack src/Utcp.Cli/Utcp.Cli.csproj -c Release --no-build -o artifacts
- name: Pack Text
run: dotnet pack csharp-utcp/src/Utcp.Text/Utcp.Text.csproj -c Release --no-build -o artifacts
run: dotnet pack src/Utcp.Text/Utcp.Text.csproj -c Release --no-build -o artifacts
- name: Pack Mcp
run: dotnet pack csharp-utcp/src/Utcp.Mcp/Utcp.Mcp.csproj -c Release --no-build -o artifacts
run: dotnet pack src/Utcp.Mcp/Utcp.Mcp.csproj -c Release --no-build -o artifacts
- name: Pack Socket
run: dotnet pack csharp-utcp/src/Utcp.Socket/Utcp.Socket.csproj -c Release --no-build -o artifacts
run: dotnet pack src/Utcp.Socket/Utcp.Socket.csproj -c Release --no-build -o artifacts
- name: Pack Gql
run: dotnet pack csharp-utcp/src/Utcp.Gql/Utcp.Gql.csproj -c Release --no-build -o artifacts
run: dotnet pack src/Utcp.Gql/Utcp.Gql.csproj -c Release --no-build -o artifacts

18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,27 @@ await foreach (var chunk in client.CallToolStreamingAsync("echo", new Dictionary
```

### Variable substitution
Namespaced variables follow the pattern `manual__{name}_VAR`. You can pass variables directly or rely on environment variables.
Namespaced variables are computed by:
- Take the namespace and replace every `_` with `__` (double underscores)
- Append `_` and the variable key

In other words: `{namespace with underscores doubled}_{KEY}`.

Examples:
- `variableNamespace = "manual_openlibrary"`, `key = "API_KEY"` → `manual__openlibrary_API_KEY`
- `variableNamespace = "ns_with_many_parts"`, `key = "TOKEN"` → `ns__with__many__parts_TOKEN`

Variables are resolved first from `UtcpClientConfig.Variables` using the namespaced key, then from environment variables using the same namespaced key. Both `$VAR` and `${VAR}` forms in strings are supported.
```csharp
using Utcp.Core.Substitution;

var substitutor = new DefaultVariableSubstitutor();
var cfg = new UtcpClientConfig { ToolRepository = repo, ToolSearchStrategy = search, Variables = new(){ ["manual__openlibrary_API_KEY"] = "123" } };
var substituted = substitutor.Substitute(new Dictionary<string, object?> { ["auth"] = new Dictionary<string, object?>{ ["token"] = "${API_KEY}" } }, cfg, "manual_openlibrary");
var substituted = substitutor.Substitute(
new Dictionary<string, object?> { ["auth"] = new Dictionary<string, object?>{ ["token"] = "${API_KEY}" } },
cfg,
"manual_openlibrary"
);
```

### OpenAPI conversion
Expand Down
Loading