Tomasz Godzik
VirtusLab
Model Context Protocol is very similar to Language Server Protocol, but instead of people it's for agents.
Host with MCP Client
MCP protocol
MCP protocol
MCP protocol
MCP Server 1
MCP Server 2
MCP Server 2
Local Data Source 1
Local Data Source 2
Web API
MCP uses Json RPC, so each possible request and response is represented by json schema
Agents can ask the server for static content (resources) that might be useful for the current context
resources/list - list all available resource
resources/read - read specific resource
{
uri: string; // Unique identifier for the resource
name: string; // Human-readable name
description?: string; // Optional description
mimeType?: string; // Optional MIME type
}Example
{
uri: "file:///logs/app.log",
name: "Application Logs",
mimeType: "text/plain"
}Agents interact with external systems, perform computations, and take actions in the real world.
tools/list - list all the tools available on the server
tools/call - invoke the tool
{
name: string; // Unique identifier for the tool
description?: string; // Human-readable description
inputSchema: { // JSON Schema for the tool's parameters
type: "object",
properties: { ... } // Tool-specific parameters
},
annotations?: {} // Optional hints about tool behavior
}Example
{
"name" : "compile-file",
"description": "Compile a chosen Scala file",
"schema" : {
"type": "object",
"properties": {
"fileInFocus": {
"type": "string",
"description": "The file to compile..."
}
}
}
}- reusable prompt templates and workflows
- standardize and share common LLM interactions
- prompts/list and prompts/get requests
{
name: string; // Unique identifier for the prompt
description?: string; // Human-readable description
arguments?: [ // Optional list of arguments
{
name: string; // Argument identifier
description?: string; // Argument description
required?: boolean; // Whether argument is required
}
]
}
Example
{
name: "explain-code",
description: "Explain how code works",
arguments: [
{
name: "code",
description: "Code to explain",
required: true
},
{
name: "language",
description: "Programming language",
required: false
}
]
}
compile-full: Compile the entire Scala project. compile-module: Compile a single module compile-file: Compile current module and show errors from the current file
In case of MBT not supported currently.
test: Run a Scala test suite or case
Often used, but my require additional direction for the agent
glob-search: Search for symbols using a glob pattern.
typed-glob-search: Search for symbols by type.
inspect: Inspect a symbol for members, signatures... get-docs: Retrieve documentation for a symbol
get-usages: Find usages of a symbol.
import-build: Trigger a build import in the IDE. format-file: Format given file, results applied directly find-dep: API to allow coursier complete-dep get-source: Get the source file for a symbol
generate-scalafix-rule: ask metals to compile and run given generate scalafix rule (highly experimental) run-scalafix-rule: run existing or previously generated rule list-scalafix-rules: list all existing and previously generated rules
But it's still useful to have that in your arsenal