Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions lib/hermes/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ defmodule Hermes.Server do

# Register with auto-derived name
component MyServer.Tools.Calculator

# Register with custom name
component MyServer.Tools.FileManager, name: "files"
"""
Expand Down Expand Up @@ -591,6 +591,7 @@ defmodule Hermes.Server do
%Resource{
uri: mod.uri(),
name: name,
title: Component.get_title(mod),
description: Component.get_description(mod),
mime_type: mod.mime_type(),
handler: mod
Expand Down Expand Up @@ -830,7 +831,7 @@ defmodule Hermes.Server do
]

model_preferences = %{"costPriority" => 1.0, "speedPriority" => 0.1, "hints" => [%{"name" => "claude"}]}

:ok = Hermes.Server.send_sampling_request(frame, messages,
model_preferences: model_preferences,
system_prompt: "You are a helpful assistant",
Expand Down
10 changes: 9 additions & 1 deletion lib/hermes/server/component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ defmodule Hermes.Server.Component do
# Simple field
field :email, {:required, :string}, format: "email", description: "User's email address"
field :age, :integer, description: "Age in years"

# Nested field
field :user do
field :name, {:required, :string}
Expand Down Expand Up @@ -315,6 +315,14 @@ defmodule Hermes.Server.Component do
end
end

def get_title(module) when is_atom(module) do
if function_exported?(module, :__title__, 0) do
module.__title__()
else
""
end
end

@doc """
Gets the component type (:tool, :prompt, or :resource).

Expand Down