-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMCPTool.CurrentTime.pas
More file actions
50 lines (44 loc) · 1.17 KB
/
MCPTool.CurrentTime.pas
File metadata and controls
50 lines (44 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
(*
MCP Tool: Current Time
This unit implements a tool that returns the current local date and time.
Sample response:
{
"content": [
{
"type": "text",
"text": "Current local time: 2025-09-23 10:38:00 (Local timezone)"
}
],
"isError": false
}
*)
unit MCPTool.CurrentTime;
uses Networking.MCP;
type
TCurrentTimeTool = class (TMCPTool)
class function Description : String; override;
begin
Result := 'Get the current local date and time';
end;
class function InputSchema : JSONVariant; override;
begin
Result := JSON.Serialize(
record
'type' := 'object';
properties := JSON.NewObject;
end
);
end;
class function Call(params : JSONVariant) : JSONVariant; override;
begin
Result := JSON.Serialize(record
content := [
record
'type' := 'text';
text := 'Current local time: ' + FormatDateTime('yyyy-mm-dd hh:nn:ss', Now) + ' (Local timezone)';
end
];
isError := False;
end);
end;
end;