ask-anychat-mcp 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ask/anychat/mcp/tools/browse_pages.rb +44 -0
- data/lib/ask/anychat/mcp/tools/get_source.rb +50 -0
- data/lib/ask/anychat/mcp/tools/list_sources.rb +49 -0
- data/lib/ask/anychat/mcp/tools/read_page.rb +49 -0
- data/lib/ask/anychat/mcp/tools/search_pages.rb +50 -0
- data/lib/ask/anychat/mcp/tools.rb +12 -2
- data/lib/ask/anychat/mcp/version.rb +1 -1
- metadata +6 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6b50da5003746ae251f776068ad9c9fef8003d7b12eccb8422f0b7d4b8f3f950
|
|
4
|
+
data.tar.gz: 262d3edeb900d4e734de383c2c2a4410c19ba8d958cee4a0a151b3a514b471cd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 62ca9bbb4f3c743684a6bc7462dc113708b312b7e15b73c327bda065ec53c8117b0d80262153773a902a1bb3851e8b20aaced077328ffb93dd5ffab2666b36d8
|
|
7
|
+
data.tar.gz: ecf788ecb55faf6fe0465f3049289aa55421773f95b2ed157646f93de8e5d85edcb605a577e9427565528d28c6d202d9d33c0048f2295cfa6437319ac007a597
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ask
|
|
4
|
+
module AnyChat
|
|
5
|
+
module MCP
|
|
6
|
+
module Tools
|
|
7
|
+
# Every page an agent may read, across its sources.
|
|
8
|
+
class BrowsePages < Tool
|
|
9
|
+
tool_name "ask_anychat_browse_pages"
|
|
10
|
+
description "List every page an agent may read in a source — the manifest — " \
|
|
11
|
+
"with set-aside pages already left out. Use this to find a page, " \
|
|
12
|
+
"then read it by reference."
|
|
13
|
+
params(
|
|
14
|
+
type: "object",
|
|
15
|
+
properties: {
|
|
16
|
+
workspace: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "The workspace's username"
|
|
19
|
+
},
|
|
20
|
+
agent: {
|
|
21
|
+
type: "string",
|
|
22
|
+
description: "The agent's handle"
|
|
23
|
+
},
|
|
24
|
+
source: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "The source's handle, as list_sources reports it"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
required: %w[workspace agent source]
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
|
|
34
|
+
def run(args)
|
|
35
|
+
pages = anychat.agent_source_pages(args["workspace"], args["agent"], args["source"])
|
|
36
|
+
return "This source has no pages yet." if pages.empty?
|
|
37
|
+
|
|
38
|
+
"#{pages.length} pages:\n#{pages.map { |p| "#{p['reference']} — #{p['title']}" }.join("\n")}"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ask
|
|
4
|
+
module AnyChat
|
|
5
|
+
module MCP
|
|
6
|
+
module Tools
|
|
7
|
+
# One source of an agent's, and what was carved out of its grant.
|
|
8
|
+
class GetSource < Tool
|
|
9
|
+
tool_name "ask_anychat_get_source"
|
|
10
|
+
description "Show one source an agent reads, by the handle list_sources returns. " \
|
|
11
|
+
"Includes which pages were set aside."
|
|
12
|
+
params(
|
|
13
|
+
type: "object",
|
|
14
|
+
properties: {
|
|
15
|
+
workspace: {
|
|
16
|
+
type: "string",
|
|
17
|
+
description: "The workspace's username"
|
|
18
|
+
},
|
|
19
|
+
agent: {
|
|
20
|
+
type: "string",
|
|
21
|
+
description: "The agent's handle"
|
|
22
|
+
},
|
|
23
|
+
source: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "The source's handle, as list_sources reports it"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
required: %w[workspace agent source]
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def run(args)
|
|
34
|
+
source = anychat.agent_source(args["workspace"], args["agent"], args["source"])
|
|
35
|
+
|
|
36
|
+
lines = [
|
|
37
|
+
"#{source['name']} (#{source['kind']}) at #{source['address']}"
|
|
38
|
+
]
|
|
39
|
+
if source["excluded_paths"]&.any?
|
|
40
|
+
lines << "Set aside: #{source['excluded_paths'].join(', ')}"
|
|
41
|
+
else
|
|
42
|
+
lines << "All pages available."
|
|
43
|
+
end
|
|
44
|
+
lines.join("\n")
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ask
|
|
4
|
+
module AnyChat
|
|
5
|
+
module MCP
|
|
6
|
+
module Tools
|
|
7
|
+
# What an agent reads: the sources it was granted.
|
|
8
|
+
class ListSources < Tool
|
|
9
|
+
tool_name "ask_anychat_list_sources"
|
|
10
|
+
description "List the sources an agent may read — the websites the workspace " \
|
|
11
|
+
"connected or the corpora it holds. Use this before browsing or " \
|
|
12
|
+
"reading pages, and before changing what an agent answers from."
|
|
13
|
+
params(
|
|
14
|
+
type: "object",
|
|
15
|
+
properties: {
|
|
16
|
+
workspace: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "The workspace's username, the first half of /<workspace>/<agent>"
|
|
19
|
+
},
|
|
20
|
+
agent: {
|
|
21
|
+
type: "string",
|
|
22
|
+
description: "The agent's handle, the second half of /<workspace>/<agent>"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
required: %w[workspace agent]
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def run(args)
|
|
31
|
+
sources = anychat.agent_sources(args["workspace"], args["agent"])
|
|
32
|
+
return "This agent has no sources yet." if sources.empty?
|
|
33
|
+
|
|
34
|
+
sources.map { |source| line(args["workspace"], args["agent"], source) }.join("\n")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def line(workspace, agent, source)
|
|
38
|
+
parts = ["#{source['name']} at /#{workspace}/#{agent}/#{source['handle']}"]
|
|
39
|
+
parts << "(#{source['kind']})" if source["kind"]
|
|
40
|
+
if source["excluded_paths"]&.any?
|
|
41
|
+
parts << "— set aside: #{source['excluded_paths'].join(', ')}"
|
|
42
|
+
end
|
|
43
|
+
parts.join(" ")
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ask
|
|
4
|
+
module AnyChat
|
|
5
|
+
module MCP
|
|
6
|
+
module Tools
|
|
7
|
+
# One page of an agent's source, as clean markdown.
|
|
8
|
+
class ReadPage < Tool
|
|
9
|
+
tool_name "ask_anychat_read_page"
|
|
10
|
+
description "Read one page an agent may read, by its reference, as clean " \
|
|
11
|
+
"markdown — from the content plane, or from the website itself " \
|
|
12
|
+
"when the plane has nothing stored."
|
|
13
|
+
params(
|
|
14
|
+
type: "object",
|
|
15
|
+
properties: {
|
|
16
|
+
workspace: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "The workspace's username"
|
|
19
|
+
},
|
|
20
|
+
agent: {
|
|
21
|
+
type: "string",
|
|
22
|
+
description: "The agent's handle"
|
|
23
|
+
},
|
|
24
|
+
source: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "The source's handle, as list_sources reports it"
|
|
27
|
+
},
|
|
28
|
+
reference: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: "The page path, e.g. /pricing or /docs/cli"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
required: %w[workspace agent source reference]
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
def run(args)
|
|
39
|
+
page = anychat.agent_source_page(
|
|
40
|
+
args["workspace"], args["agent"], args["source"], args["reference"]
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
"#{page['title']}\n\n#{page['content']}"
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ask
|
|
4
|
+
module AnyChat
|
|
5
|
+
module MCP
|
|
6
|
+
module Tools
|
|
7
|
+
# Search what an agent reads, within the pages it may read.
|
|
8
|
+
class SearchPages < Tool
|
|
9
|
+
tool_name "ask_anychat_search_pages"
|
|
10
|
+
description "Search the pages an agent may read in a source. Returns " \
|
|
11
|
+
"references, titles, and snippets — read one by reference " \
|
|
12
|
+
"for the whole page."
|
|
13
|
+
params(
|
|
14
|
+
type: "object",
|
|
15
|
+
properties: {
|
|
16
|
+
workspace: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "The workspace's username"
|
|
19
|
+
},
|
|
20
|
+
agent: {
|
|
21
|
+
type: "string",
|
|
22
|
+
description: "The agent's handle"
|
|
23
|
+
},
|
|
24
|
+
source: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "The source's handle, as list_sources reports it"
|
|
27
|
+
},
|
|
28
|
+
query: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: "What to look for"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
required: %w[workspace agent source query]
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
def run(args)
|
|
39
|
+
results = anychat.agent_source_search(
|
|
40
|
+
args["workspace"], args["agent"], args["source"], args["query"]
|
|
41
|
+
)
|
|
42
|
+
return "Nothing found for #{args["query"]}." if results.empty?
|
|
43
|
+
|
|
44
|
+
results.map { |r| "#{r['reference']} — #{r['title']}: #{r['snippet']}" }.join("\n")
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -5,19 +5,29 @@ require_relative "tools/get_agent"
|
|
|
5
5
|
require_relative "tools/create_agent"
|
|
6
6
|
require_relative "tools/update_agent"
|
|
7
7
|
require_relative "tools/delete_agent"
|
|
8
|
+
require_relative "tools/list_sources"
|
|
9
|
+
require_relative "tools/get_source"
|
|
10
|
+
require_relative "tools/browse_pages"
|
|
11
|
+
require_relative "tools/read_page"
|
|
12
|
+
require_relative "tools/search_pages"
|
|
8
13
|
|
|
9
14
|
module Ask
|
|
10
15
|
module AnyChat
|
|
11
16
|
module MCP
|
|
12
17
|
# Every tool this server exposes, in the order a model should reach for
|
|
13
|
-
# them:
|
|
18
|
+
# them: agents first, then sources, then pages.
|
|
14
19
|
module Tools
|
|
15
20
|
ALL = [
|
|
16
21
|
ListAgents,
|
|
17
22
|
GetAgent,
|
|
18
23
|
CreateAgent,
|
|
19
24
|
UpdateAgent,
|
|
20
|
-
DeleteAgent
|
|
25
|
+
DeleteAgent,
|
|
26
|
+
ListSources,
|
|
27
|
+
GetSource,
|
|
28
|
+
BrowsePages,
|
|
29
|
+
ReadPage,
|
|
30
|
+
SearchPages
|
|
21
31
|
].freeze
|
|
22
32
|
end
|
|
23
33
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ask-anychat-mcp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kaka Ruto
|
|
@@ -85,10 +85,15 @@ files:
|
|
|
85
85
|
- lib/ask/anychat/mcp.rb
|
|
86
86
|
- lib/ask/anychat/mcp/tool.rb
|
|
87
87
|
- lib/ask/anychat/mcp/tools.rb
|
|
88
|
+
- lib/ask/anychat/mcp/tools/browse_pages.rb
|
|
88
89
|
- lib/ask/anychat/mcp/tools/create_agent.rb
|
|
89
90
|
- lib/ask/anychat/mcp/tools/delete_agent.rb
|
|
90
91
|
- lib/ask/anychat/mcp/tools/get_agent.rb
|
|
92
|
+
- lib/ask/anychat/mcp/tools/get_source.rb
|
|
91
93
|
- lib/ask/anychat/mcp/tools/list_agents.rb
|
|
94
|
+
- lib/ask/anychat/mcp/tools/list_sources.rb
|
|
95
|
+
- lib/ask/anychat/mcp/tools/read_page.rb
|
|
96
|
+
- lib/ask/anychat/mcp/tools/search_pages.rb
|
|
92
97
|
- lib/ask/anychat/mcp/tools/update_agent.rb
|
|
93
98
|
- lib/ask/anychat/mcp/version.rb
|
|
94
99
|
homepage: https://github.com/ask-rb/ask-anychat-mcp
|